ordering-ui-react-native 0.16.51 → 0.16.54

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.
Files changed (22) hide show
  1. package/package.json +1 -1
  2. package/themes/original/src/components/BusinessBasicInformation/index.tsx +197 -142
  3. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  4. package/themes/original/src/components/BusinessProductsListing/index.tsx +34 -8
  5. package/themes/original/src/components/BusinessProductsListing/styles.tsx +5 -0
  6. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +9 -1
  7. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  8. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +216 -67
  9. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +46 -2
  10. package/themes/original/src/components/BusinessesListing/index.tsx +69 -21
  11. package/themes/original/src/components/GoogleMap/index.tsx +10 -11
  12. package/themes/original/src/components/OrderDetails/index.tsx +32 -34
  13. package/themes/original/src/components/ReviewOrder/index.tsx +79 -99
  14. package/themes/original/src/components/ReviewOrder/styles.tsx +0 -9
  15. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  16. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  17. package/themes/original/src/components/ServiceForm/index.tsx +15 -5
  18. package/themes/original/src/components/SingleProductCard/index.tsx +106 -88
  19. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  20. package/themes/original/src/components/shared/OBottomPopup.tsx +31 -9
  21. package/themes/original/src/components/shared/OButton.tsx +2 -0
  22. package/themes/original/src/types/index.tsx +16 -15
@@ -12,7 +12,7 @@ import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, R
12
12
  import { StyleSheet, View, TouchableOpacity, Image } from 'react-native';
13
13
  import { InView } from 'react-native-intersection-observer'
14
14
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
15
- import { OText } from '../shared';
15
+ import { OButton, OText } from '../shared';
16
16
  import FastImage from 'react-native-fast-image'
17
17
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
18
18
  import { shape } from '../../utils';
@@ -36,6 +36,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
36
36
  } = props;
37
37
 
38
38
  const theme = useTheme();
39
+ const showAddButton = !theme?.layouts?.business_view?.components?.products?.components?.add_to_cart_button?.hidden
39
40
 
40
41
  const styles = StyleSheet.create({
41
42
  container: {
@@ -89,8 +90,9 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
89
90
  const [, t] = useLanguage();
90
91
  const [stateConfig] = useConfig();
91
92
  const [{ parsePrice, optimizeImage }] = useUtils();
92
- const [orderState] = useOrder();
93
+ const [orderState] = useOrder()
93
94
  const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
95
+
94
96
  const editMode = typeof product?.code !== 'undefined';
95
97
 
96
98
  const removeToBalance = editMode ? product?.quantity : 0;
@@ -123,107 +125,123 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
123
125
  <InView style={{ minHeight: 140 }} triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(true)}>
124
126
  {isIntersectionObserver && (
125
127
  <CardContainer
128
+ showAddButton={showAddButton}
126
129
  style={[
127
130
  styles.container,
128
131
  (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
129
132
  (style && { ...style }),
130
133
  ]}
131
- onPress={() => onProductClick?.(product)}>
132
- {productAddedToCartLength > 0 && (
133
- <QuantityContainer style={[styles.quantityContainer, {
134
- transform: [{ translateX: 10 }, { translateY: -10 }],
135
- }]}>
136
- <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
137
- </QuantityContainer>
138
- )}
139
- <CardInfo>
140
- <View style={styles.titleWrapper}>
134
+ onPress={() => onProductClick?.(product)}
135
+ >
136
+ <View style={{ flexDirection: 'row' }}>
137
+ {productAddedToCartLength > 0 && (
138
+ <QuantityContainer style={[styles.quantityContainer, {
139
+ transform: [{ translateX: 10 }, { translateY: -10 }],
140
+ }]}>
141
+ <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
142
+ </QuantityContainer>
143
+ )}
144
+ <CardInfo>
145
+ <View style={styles.titleWrapper}>
146
+ <OText
147
+ size={12}
148
+ weight={'500'}
149
+ numberOfLines={1}
150
+ ellipsizeMode="tail"
151
+ style={styles.line18}>
152
+ {product?.name}
153
+ </OText>
154
+ <TouchableOpacity
155
+ onPress={handleChangeFavorite}
156
+ >
157
+ <IconAntDesign
158
+ name={product?.favorite ? 'heart' : 'hearto'}
159
+ color={theme.colors.danger5}
160
+ size={18}
161
+ />
162
+ </TouchableOpacity>
163
+ </View>
164
+ <PricesContainer>
165
+ <OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
166
+ {product?.offer_price !== null && product?.in_offer && (
167
+ <OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
168
+ )}
169
+ </PricesContainer>
141
170
  <OText
142
- size={12}
143
- weight={'500'}
144
- numberOfLines={1}
171
+ size={10}
172
+ numberOfLines={2}
145
173
  ellipsizeMode="tail"
146
- style={styles.line18}>
147
- {product?.name}
174
+ color={theme.colors.textSecondary}
175
+ style={styles.line15}>
176
+ {product?.description}
148
177
  </OText>
149
- <TouchableOpacity
150
- onPress={handleChangeFavorite}
151
- >
152
- <IconAntDesign
153
- name={product?.favorite ? 'heart' : 'hearto'}
154
- color={theme.colors.danger5}
155
- size={18}
178
+ </CardInfo>
179
+ <LogoWrapper>
180
+ {product?.ribbon?.enabled && (
181
+ <RibbonBox
182
+ bgColor={product?.ribbon?.color}
183
+ isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
184
+ isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
185
+ >
186
+ <OText
187
+ size={10}
188
+ weight={'400'}
189
+ color={theme.colors.white}
190
+ numberOfLines={2}
191
+ ellipsizeMode='tail'
192
+ lineHeight={13}
193
+ >
194
+ {product?.ribbon?.text}
195
+ </OText>
196
+ </RibbonBox>
197
+ )}
198
+ {product?.images ? (
199
+ <FastImage
200
+ style={styles.productStyle}
201
+ source={{
202
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
203
+ priority: FastImage.priority.normal,
204
+ }}
205
+ resizeMode={FastImage.resizeMode.cover}
206
+ />
207
+ ) : (
208
+ <FastImage
209
+ style={styles.productStyle}
210
+ source={{
211
+ uri: Image.resolveAssetSource(theme.images.dummies.product).uri,
212
+ priority: FastImage.priority.normal,
213
+ }}
214
+ resizeMode={FastImage.resizeMode.cover}
156
215
  />
157
- </TouchableOpacity>
158
- </View>
159
- <PricesContainer>
160
- <OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
161
- {product?.offer_price !== null && product?.in_offer && (
162
- <OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
163
216
  )}
164
- </PricesContainer>
165
- <OText
166
- size={10}
167
- numberOfLines={2}
168
- ellipsizeMode="tail"
169
- color={theme.colors.textSecondary}
170
- style={styles.line15}>
171
- {product?.description}
172
- </OText>
173
- </CardInfo>
174
- <LogoWrapper>
175
- {product?.ribbon?.enabled && (
176
- <RibbonBox
177
- bgColor={product?.ribbon?.color}
178
- isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
179
- isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
180
- >
181
- <OText
182
- size={10}
183
- weight={'400'}
184
- color={theme.colors.white}
185
- numberOfLines={2}
186
- ellipsizeMode='tail'
187
- lineHeight={13}
188
- >
189
- {product?.ribbon?.text}
217
+ </LogoWrapper>
218
+
219
+ {(isSoldOut || maxProductQuantity <= 0) && (
220
+ <SoldOut>
221
+ <OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
222
+ {t('SOLD_OUT', 'SOLD OUT')}
190
223
  </OText>
191
- </RibbonBox>
224
+ </SoldOut>
192
225
  )}
193
- {product?.images ? (
194
- <>
195
- {isIntersectionObserver && (
196
- <FastImage
197
- style={styles.productStyle}
198
- source={{
199
- uri: optimizeImage(product?.images, 'h_250,c_limit'),
200
- priority: FastImage.priority.normal,
201
- }}
202
- resizeMode={FastImage.resizeMode.cover}
203
- />
204
- )}
205
- </>
206
- ) : (
207
- <FastImage
208
- style={styles.productStyle}
209
- source={{
210
- uri: Image.resolveAssetSource(theme.images.dummies.product).uri,
211
- priority: FastImage.priority.normal,
212
- }}
213
- resizeMode={FastImage.resizeMode.cover}
214
- />
215
- )}
216
- </LogoWrapper>
217
- {(isSoldOut || maxProductQuantity <= 0) && (
218
- <SoldOut>
219
- <OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
220
- {t('SOLD_OUT', 'SOLD OUT')}
221
- </OText>
222
- </SoldOut>
226
+ </View>
227
+ {showAddButton && (
228
+ <OButton
229
+ onClick={() => onProductClick?.(product)}
230
+ style={{
231
+ width: '100%',
232
+ borderRadius: 7.6,
233
+ marginTop: 10,
234
+
235
+ }}
236
+ bgColor={isSoldOut ? '#B8B8B8' : theme?.colors?.white}
237
+ borderColor={theme?.colors.primary}
238
+ textStyle={{ color: theme.colors.primary }}
239
+ text={t('ADD', 'Add')}
240
+ />
223
241
  )}
224
242
  </CardContainer>
225
243
  )}
226
- </InView >
244
+ </InView>
227
245
  );
228
246
  }, SingleProductCardPropsAreEqual);
229
247
 
@@ -2,7 +2,7 @@ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const CardContainer = styled.TouchableOpacity`
4
4
  flex: 1;
5
- flex-direction: row;
5
+ flex-direction: ${(props : any) => props.showAddButton ? 'column' : 'row'};
6
6
  justify-content: space-between;
7
7
  align-items: center;
8
8
  padding: 12px;
@@ -23,7 +23,7 @@ export const SoldOut = styled.View`
23
23
  `
24
24
 
25
25
  export const QuantityContainer = styled.View`
26
- background: ${({ theme } : any) => theme.colors.primary};
26
+ background: ${({ theme }: any) => theme.colors.primary};
27
27
  align-items: center;
28
28
  justify-content: center;
29
29
  `
@@ -1,33 +1,43 @@
1
1
  import React from 'react'
2
- import { Modal, TouchableWithoutFeedback, Dimensions, StyleSheet, View, Text, Platform, StatusBar } from 'react-native'
2
+ import { Modal, TouchableWithoutFeedback, TouchableOpacity, Dimensions, StyleSheet, View, Text, Platform, StatusBar } from 'react-native'
3
3
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
4
+ import { OIcon } from '.';
4
5
  const deviceHeight = Dimensions.get('window').height
5
6
 
6
7
  interface Props {
7
8
  open: boolean;
9
+ transparent?: boolean;
8
10
  title?: string;
9
11
  children?: any;
10
12
  onClose?: any;
11
13
  isStatusBar?: boolean;
14
+ bottomContainerStyle?: any;
15
+ titleStyle?: any;
16
+ closeIcon?: any;
12
17
  }
13
18
  const OBottomPopup = (props: Props) => {
14
19
  const {
15
20
  open,
21
+ transparent,
16
22
  title,
17
23
  onClose,
18
24
  children,
19
- isStatusBar
25
+ isStatusBar,
26
+ titleStyle,
27
+ bottomContainerStyle,
28
+ closeIcon
20
29
  } = props
21
30
  const { top, bottom } = useSafeAreaInsets();
31
+
22
32
  return (
23
33
  <Modal
24
34
  animationType='slide'
25
- transparent={false}
35
+ transparent={transparent}
26
36
  visible={open}
27
37
  onRequestClose={() => onClose()}
28
38
  presentationStyle={'fullScreen'}
29
39
  >
30
- {isStatusBar && <StatusBar translucent={false} />}
40
+ {isStatusBar && <StatusBar translucent={false} />}
31
41
  <View style={styles.container}>
32
42
  <TouchableWithoutFeedback
33
43
  style={styles.touchableOutsideStyle}
@@ -35,10 +45,18 @@ const OBottomPopup = (props: Props) => {
35
45
  >
36
46
  <View style={styles.touchableOutsideStyle} />
37
47
  </TouchableWithoutFeedback>
38
- <View style={styles.bottomContainer}>
48
+ <View style={{ ...styles.bottomContainer, ...bottomContainerStyle }}>
39
49
  <View style={{ paddingTop: top, paddingBottom: bottom }}>
40
- {title != '' && (
41
- <Text style={styles.titleStyle}>
50
+ {closeIcon && (
51
+ <TouchableOpacity onPress={onClose} style={styles.closeIconStyle}>
52
+ <OIcon
53
+ src={closeIcon}
54
+ width={30}
55
+ />
56
+ </TouchableOpacity>
57
+ )}
58
+ {!!title && (
59
+ <Text style={{ ...styles.titleStyle, ...titleStyle }}>
42
60
  {title}
43
61
  </Text>
44
62
  )}
@@ -54,7 +72,7 @@ const styles = StyleSheet.create({
54
72
  container: {
55
73
  flex: 1,
56
74
  backgroundColor: '#000000AA',
57
- justifyContent: 'flex-end',
75
+ justifyContent: 'flex-end'
58
76
  },
59
77
  touchableOutsideStyle: {
60
78
  flex: 1,
@@ -69,7 +87,11 @@ const styles = StyleSheet.create({
69
87
  titleStyle: {
70
88
  fontSize: 20,
71
89
  fontWeight: 'bold',
72
- marginVertical: 15
90
+ marginVertical: 10
91
+ },
92
+ closeIconStyle: {
93
+ paddingTop: 20,
94
+ paddingLeft: 20
73
95
  }
74
96
  })
75
97
 
@@ -78,6 +78,7 @@ interface Props {
78
78
  borderColor?: string;
79
79
  loadingStyle?: ViewStyle;
80
80
  showNextIcon?: boolean;
81
+ isDisabledWithSameStyles?: boolean;
81
82
  }
82
83
 
83
84
  const OButton = (props: Props): React.ReactElement => {
@@ -110,6 +111,7 @@ const OButton = (props: Props): React.ReactElement => {
110
111
  activeOpacity={props.activeOpacity}
111
112
  onPress={props.onClick}
112
113
  style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
114
+ disabled={props.isDisabledWithSameStyles}
113
115
  >
114
116
  <StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor } : props.style}>
115
117
  {props.imgLeftSrc ? (
@@ -417,25 +417,26 @@ export interface ProductItemAccordionParams {
417
417
  isFromCheckout?: any
418
418
  }
419
419
  export interface ReviewOrderParams {
420
- order?: { id: number, businessId: number, business_name?: string, delivery_datetime?: string, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
421
- stars?: any,
422
- handleChangeInput?: any,
423
- handleChangeRating?: any,
424
- handleSendReview?: any,
425
- formState?: any,
426
- navigation?: any,
427
- setIsReviewed?: (isReviewed: boolean) => {},
428
- handleReviewState?: any,
429
- setStars?: any,
430
- onNavigationRedirect?: any
420
+ order?: { id: number, business_id: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any };
421
+ stars?: any;
422
+ defaultStar?: number;
423
+ handleChangeInput?: any;
424
+ handleChangeRating?: any;
425
+ handleSendReview?: any;
426
+ formState?: any;
427
+ navigation?: any;
428
+ setIsReviewed?: (isReviewed: boolean) => void;
429
+ handleReviewState?: any;
430
+ setStars?: any;
431
+ onNavigationRedirect?: any;
431
432
  }
432
433
  export interface ReviewProductParams {
433
434
  navigation?: any,
434
435
  onNavigationRedirect?: any,
435
- order?: { orderId: number, businessId: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
436
+ order?: { orderId: number, business_id: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
436
437
  formState?: any,
437
438
  handleChangeFormState?: any,
438
- handleSendProductReview?: any
439
+ handleSendProductReview?: any;
439
440
  }
440
441
  export interface SingleProductReviewParams {
441
442
  product: any,
@@ -445,12 +446,12 @@ export interface SingleProductReviewParams {
445
446
  export interface ReviewDriverParams {
446
447
  navigation?: any,
447
448
  onNavigationRedirect?: any,
448
- order?: { orderId: number, businessId: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
449
+ order?: { orderId: number, business_id: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
449
450
  formState?: any,
450
451
  setIsDriverReviewed?: (isReviewed: boolean) => {},
451
452
  dirverReviews?: any,
452
453
  setDriverReviews?: any,
453
- handleSendDriverReview?: any
454
+ handleSendDriverReview?: any;
454
455
  }
455
456
  export interface MessagesParams {
456
457
  type?: string,