ordering-ui-react-native 0.18.94 → 0.18.96

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.94",
3
+ "version": "0.18.96",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { StyleSheet, View, RefreshControl, ScrollView, Pressable } from 'react-native';
2
+ import { StyleSheet, View, Pressable, TouchableOpacity } from 'react-native';
3
3
  import { useLanguage } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
 
@@ -9,6 +9,7 @@ import OButton from '../../components/shared/OButton';
9
9
  import { LanguageSelector } from '../../components/LanguageSelector';
10
10
  import { LogoutPopup } from '../../components/LogoutPopup';
11
11
  import { PORTRAIT, LANDSCAPE, useDeviceOrientation } from "../../../../../src/hooks/DeviceOrientation";
12
+ import { OIcon } from '../../components/shared';
12
13
 
13
14
  const Intro = (props: any): React.ReactElement => {
14
15
  const { navigation } = props;
@@ -41,6 +42,19 @@ const Intro = (props: any): React.ReactElement => {
41
42
  // />
42
43
  // }
43
44
  // >
45
+ <>
46
+ <View style={{ position: 'absolute', top: 25, right: 20, zIndex: 1000 }}>
47
+ <TouchableOpacity
48
+ onPress={() => setShowLogoutPopup(true)}
49
+ >
50
+ <OIcon
51
+ src={theme.images.general.menulogout}
52
+ width={24}
53
+ height={24}
54
+ color={theme.colors.disabledContrast}
55
+ />
56
+ </TouchableOpacity>
57
+ </View>
44
58
  <Pressable onPress={goBusiness}>
45
59
  <View style={{ height: orientationState?.dimensions?.height }}>
46
60
  {orientationState.orientation === PORTRAIT ? (
@@ -134,6 +148,7 @@ const Intro = (props: any): React.ReactElement => {
134
148
  />
135
149
  </View>
136
150
  </Pressable>
151
+ </>
137
152
  // </ScrollView>
138
153
  );
139
154
  };
@@ -146,7 +146,7 @@ export const BusinessBasicInformation = (
146
146
  }
147
147
 
148
148
  const getBusinessType = () => {
149
- if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
149
+ if (Object.keys(business || {}).length <= 0) return t('GENERAL', 'General');
150
150
  const _types: any = [];
151
151
  types.forEach(
152
152
  (type) =>
@@ -42,7 +42,6 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
42
42
  navigation,
43
43
  isBusinessOpen,
44
44
  style,
45
- isCustomLayout,
46
45
  businessHeader,
47
46
  businessFeatured,
48
47
  businessLogo,
@@ -76,7 +75,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
76
75
  const hideBusinessHeader = theme?.business_listing_view?.components?.business?.components?.header?.hidden
77
76
  const hideBusinessFavoriteBadge = theme?.business_listing_view?.components?.business?.components?.featured_badge?.hidden
78
77
 
79
- const textSize = isCustomLayout ? 12 : 10
78
+ const textSize = 12
80
79
  const cardHeight = windowHeight * 0.3
81
80
 
82
81
  const styles = StyleSheet.create({
@@ -214,7 +213,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
214
213
  <BusinessHero>
215
214
  {!hideBusinessHeader && (
216
215
  <FastImage
217
- style={{ height: isCustomLayout ? cardHeight * 0.66 : 120 }}
216
+ style={{ height: cardHeight * 0.66 }}
218
217
  source={(businessHeader || business?.header || typeof theme.images.dummies.businessHeader === 'string') ? {
219
218
  uri: optimizeImage(businessHeader || business?.header || theme.images.dummies.businessHeader, 'h_500,c_limit'),
220
219
  priority: FastImage.priority.normal,
@@ -227,7 +226,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
227
226
  <FontAwesomeIcon name="crown" size={26} color="gold" />
228
227
  </View>
229
228
  )}
230
- {(!isCustomLayout) && !hideBusinessOffer && (
229
+ {!hideBusinessOffer && (
231
230
  getBusinessOffer((business?.offers)) &&
232
231
  <OfferBox
233
232
  isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}
@@ -257,7 +256,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
257
256
  </BusinessState>
258
257
  </BusinessHero>
259
258
  <BusinessContent>
260
- <BusinessInfo style={isCustomLayout && { position: 'absolute', bottom: 85, left: 15 }}>
259
+ <BusinessInfo style={{ position: 'absolute', bottom: 85, left: 15 }}>
261
260
  {!hideBusinessLogo && (
262
261
  <BusinessLogo style={styles.businessLogo}>
263
262
  <FastImage
@@ -270,38 +269,15 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
270
269
  />
271
270
  </BusinessLogo>
272
271
  )}
273
- {!isCustomLayout && (!hideBusinessFavorite || !hideBusinessReviews) && (
274
- <ReviewAndFavorite>
275
- {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && !hideBusinessReviews && (
276
- <Reviews>
277
- <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
278
- <OText size={10} style={{ lineHeight: 15 }}>
279
- {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
280
- </OText>
281
- </Reviews>
282
- )}
283
- {!hideBusinessFavorite && (
284
- <LottieAnimation
285
- type='favorite'
286
- onClick={handleChangeFavorite}
287
- initialValue={business?.favorite ? 0.5 : 0}
288
- toValue={business?.favorite ? 0 : 0.5}
289
- disableAnimation={!auth}
290
- iconProps={{ color: theme.colors.danger5, size: 18 }}
291
- isActive={business?.favorite}
292
- />
293
- )}
294
- </ReviewAndFavorite>
295
- )}
296
272
  </BusinessInfo>
297
- <View style={isCustomLayout && { width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5 }}>
273
+ <View style={{ width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5 }}>
298
274
  <OText
299
275
  size={textSize + 2}
300
276
  style={{ lineHeight: 18, marginBottom: 6 }}
301
277
  weight={'500'}>
302
278
  {business?.name}
303
279
  </OText>
304
- {isCustomLayout && (!hideBusinessFavorite || !hideBusinessReviews) && (
280
+ {(!hideBusinessFavorite || !hideBusinessReviews) && (
305
281
  <ReviewAndFavorite>
306
282
  {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && !hideBusinessReviews && (
307
283
  <Reviews>
@@ -325,7 +301,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
325
301
  </ReviewAndFavorite>
326
302
  )}
327
303
  </View>
328
- <OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={isCustomLayout ? 1 : 2}>
304
+ <OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={1}>
329
305
  {business?.address}
330
306
  </OText>
331
307
  <Metadata>
@@ -691,8 +691,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
691
691
  <ServiceForm
692
692
  navigation={navigation}
693
693
  product={currentProduct}
694
- businessSlug={business.slug}
695
- businessId={business.id}
694
+ businessSlug={business?.slug}
695
+ businessId={business?.id}
696
696
  professionalList={business?.professionals}
697
697
  professionalSelected={professionalSelected}
698
698
  handleChangeProfessional={handleChangeProfessionalSelected}
@@ -605,7 +605,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
605
605
  <BusinessController
606
606
  key={`${business.id}_` + i}
607
607
  enableIntersection
608
- isCustomLayout={isChewLayout}
609
608
  business={business}
610
609
  isBusinessOpen={business.open}
611
610
  handleCustomClick={handleBusinessClick}
@@ -108,14 +108,14 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
108
108
  /* const toggleAccordion = () => {
109
109
  if ((!product?.valid_menu && isCartProduct)) return
110
110
  if (isActive) {
111
- Animated.timing(setHeight.height, {
111
+ Animated.timing(setHeight.height, {
112
112
  toValue: 100,
113
113
  duration: 500,
114
114
  easing: Easing.linear,
115
115
  useNativeDriver: false,
116
- }).start()
116
+ }).start()
117
117
  } else {
118
- setHeightState({height: new Animated.Value(0)})
118
+ setHeightState({height: new Animated.Value(0)})
119
119
  }
120
120
  }*/
121
121
 
@@ -136,7 +136,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
136
136
  }
137
137
 
138
138
  /*useEffect(() => {
139
- toggleAccordion()
139
+ toggleAccordion()
140
140
  }, [isActive])*/
141
141
 
142
142
  const productOptions = getProductMax && [...Array(getProductMax(product) + 1),].map((_: any, opt: number) => {
@@ -289,7 +289,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
289
289
  )}
290
290
  {productInfo().options.length > 0 && (
291
291
  <ProductOptionsList>
292
- {productInfo().options.map((option: any, i: number) => (
292
+ {productInfo().options.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => (
293
293
  <ProductOption key={option.id + i}>
294
294
  <OText size={10} color={theme.colors.textSecondary}>{option.name}</OText>
295
295
  {option.suboptions.map((suboption: any) => (