ordering-ui-react-native 0.16.50 → 0.16.53

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 (28) hide show
  1. package/package.json +1 -1
  2. package/src/components/ReviewProducts/index.tsx +11 -0
  3. package/src/components/SingleProductReview/index.tsx +1 -1
  4. package/themes/original/index.tsx +6 -0
  5. package/themes/original/src/components/BusinessBasicInformation/index.tsx +197 -142
  6. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  7. package/themes/original/src/components/BusinessProductsListing/index.tsx +34 -8
  8. package/themes/original/src/components/BusinessProductsListing/styles.tsx +5 -0
  9. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +9 -1
  10. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  11. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +238 -94
  12. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +46 -2
  13. package/themes/original/src/components/BusinessesListing/index.tsx +98 -23
  14. package/themes/original/src/components/GoogleMap/index.tsx +10 -11
  15. package/themes/original/src/components/Reviews/ReviewDriver/index.tsx +301 -0
  16. package/themes/original/src/components/Reviews/ReviewDriver/styles.tsx +39 -0
  17. package/themes/original/src/components/Reviews/ReviewOrder/index.tsx +326 -0
  18. package/themes/original/src/components/Reviews/ReviewOrder/styles.tsx +53 -0
  19. package/themes/original/src/components/Reviews/ReviewProducts/index.tsx +101 -0
  20. package/themes/original/src/components/Reviews/ReviewProducts/styles.tsx +17 -0
  21. package/themes/original/src/components/Reviews/index.tsx +9 -0
  22. package/themes/original/src/components/ServiceForm/index.tsx +15 -5
  23. package/themes/original/src/components/SignupForm/index.tsx +26 -24
  24. package/themes/original/src/components/SingleProductCard/index.tsx +113 -103
  25. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  26. package/themes/original/src/components/shared/OBottomPopup.tsx +26 -7
  27. package/themes/original/src/components/shared/OButton.tsx +2 -0
  28. package/themes/original/src/types/index.tsx +19 -15
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React from 'react';
2
2
  import {
3
3
  useLanguage,
4
4
  useConfig,
@@ -10,9 +10,7 @@ import { useTheme } from 'styled-components/native';
10
10
  import { SingleProductCardParams } from '../../types';
11
11
  import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
12
12
  import { StyleSheet, View, TouchableOpacity, Image } from 'react-native';
13
- import { InView } from 'react-native-intersection-observer'
14
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
15
- import { OText } from '../shared';
13
+ import { OButton, OText } from '../shared';
16
14
  import FastImage from 'react-native-fast-image'
17
15
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
18
16
  import { shape } from '../../utils';
@@ -31,11 +29,11 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
31
29
  onProductClick,
32
30
  productAddedToCartLength,
33
31
  style,
34
- handleFavoriteProduct,
35
- enableIntersection
32
+ handleFavoriteProduct
36
33
  } = props;
37
34
 
38
35
  const theme = useTheme();
36
+ const showAddButton = !theme?.layouts?.business_view?.components?.products?.components?.add_to_cart_button?.hidden
39
37
 
40
38
  const styles = StyleSheet.create({
41
39
  container: {
@@ -90,7 +88,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
90
88
  const [stateConfig] = useConfig();
91
89
  const [{ parsePrice, optimizeImage }] = useUtils();
92
90
  const [orderState] = useOrder();
93
- const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
91
+
94
92
  const editMode = typeof product?.code !== 'undefined';
95
93
 
96
94
  const removeToBalance = editMode ? product?.quantity : 0;
@@ -120,110 +118,122 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
120
118
  }
121
119
 
122
120
  return (
123
- <InView style={{ minHeight: 140 }} triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(true)}>
124
- {isIntersectionObserver && (
125
- <CardContainer
126
- style={[
127
- styles.container,
128
- (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
129
- (style && { ...style }),
130
- ]}
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}>
141
- <OText
142
- size={12}
143
- weight={'500'}
144
- numberOfLines={1}
145
- ellipsizeMode="tail"
146
- style={styles.line18}>
147
- {product?.name}
148
- </OText>
149
- <TouchableOpacity
150
- onPress={handleChangeFavorite}
151
- >
152
- <IconAntDesign
153
- name={product?.favorite ? 'heart' : 'hearto'}
154
- color={theme.colors.danger5}
155
- size={18}
156
- />
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
- )}
164
- </PricesContainer>
121
+ <CardContainer
122
+ showAddButton={showAddButton}
123
+ style={[
124
+ styles.container,
125
+ (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
126
+ (style && { ...style }),
127
+ ]}
128
+ onPress={() => onProductClick?.(product)}
129
+ >
130
+ <View style={{ flexDirection: 'row' }}>
131
+ {productAddedToCartLength > 0 && (
132
+ <QuantityContainer style={[styles.quantityContainer, {
133
+ transform: [{ translateX: 10 }, { translateY: -10 }],
134
+ }]}>
135
+ <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
136
+ </QuantityContainer>
137
+ )}
138
+ <CardInfo>
139
+ <View style={styles.titleWrapper}>
165
140
  <OText
166
- size={10}
167
- numberOfLines={2}
141
+ size={12}
142
+ weight={'500'}
143
+ numberOfLines={1}
168
144
  ellipsizeMode="tail"
169
- color={theme.colors.textSecondary}
170
- style={styles.line15}>
171
- {product?.description}
145
+ style={styles.line18}>
146
+ {product?.name}
172
147
  </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}
190
- </OText>
191
- </RibbonBox>
192
- )}
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}
148
+ <TouchableOpacity
149
+ onPress={handleChangeFavorite}
150
+ >
151
+ <IconAntDesign
152
+ name={product?.favorite ? 'heart' : 'hearto'}
153
+ color={theme.colors.danger5}
154
+ size={18}
214
155
  />
156
+ </TouchableOpacity>
157
+ </View>
158
+ <PricesContainer>
159
+ <OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
160
+ {product?.offer_price !== null && product?.in_offer && (
161
+ <OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
215
162
  )}
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')}
163
+ </PricesContainer>
164
+ <OText
165
+ size={10}
166
+ numberOfLines={2}
167
+ ellipsizeMode="tail"
168
+ color={theme.colors.textSecondary}
169
+ style={styles.line15}>
170
+ {product?.description}
171
+ </OText>
172
+ </CardInfo>
173
+ <LogoWrapper>
174
+ {product?.ribbon?.enabled && (
175
+ <RibbonBox
176
+ bgColor={product?.ribbon?.color}
177
+ isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
178
+ isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
179
+ >
180
+ <OText
181
+ size={10}
182
+ weight={'400'}
183
+ color={theme.colors.white}
184
+ numberOfLines={2}
185
+ ellipsizeMode='tail'
186
+ lineHeight={13}
187
+ >
188
+ {product?.ribbon?.text}
221
189
  </OText>
222
- </SoldOut>
190
+ </RibbonBox>
191
+ )}
192
+ {product?.images ? (
193
+ <FastImage
194
+ style={styles.productStyle}
195
+ source={{
196
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
197
+ priority: FastImage.priority.normal,
198
+ }}
199
+ resizeMode={FastImage.resizeMode.cover}
200
+ />
201
+ ) : (
202
+ <FastImage
203
+ style={styles.productStyle}
204
+ source={{
205
+ uri: Image.resolveAssetSource(theme.images.dummies.product).uri,
206
+ priority: FastImage.priority.normal,
207
+ }}
208
+ resizeMode={FastImage.resizeMode.cover}
209
+ />
223
210
  )}
224
- </CardContainer>
211
+ </LogoWrapper>
212
+
213
+ {(isSoldOut || maxProductQuantity <= 0) && (
214
+ <SoldOut>
215
+ <OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
216
+ {t('SOLD_OUT', 'SOLD OUT')}
217
+ </OText>
218
+ </SoldOut>
219
+ )}
220
+ </View>
221
+ {showAddButton && (
222
+ <OButton
223
+ onClick={() => onProductClick?.(product)}
224
+ style={{
225
+ width: '100%',
226
+ borderRadius: 7.6,
227
+ marginTop: 10,
228
+
229
+ }}
230
+ bgColor={isSoldOut ? '#B8B8B8' : theme?.colors?.white}
231
+ borderColor={theme?.colors.primary}
232
+ textStyle={{color: theme.colors.primary}}
233
+ text={t('ADD', 'Add')}
234
+ />
225
235
  )}
226
- </InView >
236
+ </CardContainer>
227
237
  );
228
238
  }, SingleProductCardPropsAreEqual);
229
239
 
@@ -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,6 +1,7 @@
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 {
@@ -9,6 +10,9 @@ interface Props {
9
10
  children?: any;
10
11
  onClose?: any;
11
12
  isStatusBar?: boolean;
13
+ bottomContainerStyle?: any;
14
+ titleStyle?: any;
15
+ closeIcon?: any;
12
16
  }
13
17
  const OBottomPopup = (props: Props) => {
14
18
  const {
@@ -16,7 +20,10 @@ const OBottomPopup = (props: Props) => {
16
20
  title,
17
21
  onClose,
18
22
  children,
19
- isStatusBar
23
+ isStatusBar,
24
+ titleStyle,
25
+ bottomContainerStyle,
26
+ closeIcon
20
27
  } = props
21
28
  const { top, bottom } = useSafeAreaInsets();
22
29
  return (
@@ -27,7 +34,7 @@ const OBottomPopup = (props: Props) => {
27
34
  onRequestClose={() => onClose()}
28
35
  presentationStyle={'fullScreen'}
29
36
  >
30
- {isStatusBar && <StatusBar translucent={false} />}
37
+ {isStatusBar && <StatusBar translucent={false} />}
31
38
  <View style={styles.container}>
32
39
  <TouchableWithoutFeedback
33
40
  style={styles.touchableOutsideStyle}
@@ -35,10 +42,18 @@ const OBottomPopup = (props: Props) => {
35
42
  >
36
43
  <View style={styles.touchableOutsideStyle} />
37
44
  </TouchableWithoutFeedback>
38
- <View style={styles.bottomContainer}>
45
+ <View style={{ ...styles.bottomContainer, ...bottomContainerStyle }}>
39
46
  <View style={{ paddingTop: top, paddingBottom: bottom }}>
40
- {title != '' && (
41
- <Text style={styles.titleStyle}>
47
+ {closeIcon && (
48
+ <TouchableOpacity onPress={onClose} style={styles.closeIconStyle}>
49
+ <OIcon
50
+ src={closeIcon}
51
+ width={30}
52
+ />
53
+ </TouchableOpacity>
54
+ )}
55
+ {!!title && (
56
+ <Text style={{ ...styles.titleStyle, ...titleStyle }}>
42
57
  {title}
43
58
  </Text>
44
59
  )}
@@ -69,7 +84,11 @@ const styles = StyleSheet.create({
69
84
  titleStyle: {
70
85
  fontSize: 20,
71
86
  fontWeight: 'bold',
72
- marginVertical: 15
87
+ marginVertical: 10
88
+ },
89
+ closeIconStyle: {
90
+ paddingTop: 20,
91
+ paddingLeft: 20
73
92
  }
74
93
  })
75
94
 
@@ -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,28 @@ 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, 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) => void;
428
+ handleReviewState?: any;
429
+ setStars?: any;
430
+ onNavigationRedirect?: any;
431
+ closeReviewOrder?: () => void;
432
+ skipReview?: () => void;
431
433
  }
432
434
  export interface ReviewProductParams {
433
435
  navigation?: any,
434
436
  onNavigationRedirect?: any,
435
- order?: { orderId: number, businessId: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
437
+ order?: { orderId: number, business_id: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
436
438
  formState?: any,
437
439
  handleChangeFormState?: any,
438
- handleSendProductReview?: any
440
+ handleSendProductReview?: any;
441
+ closeReviewProduct?: () => void;
439
442
  }
440
443
  export interface SingleProductReviewParams {
441
444
  product: any,
@@ -445,12 +448,13 @@ export interface SingleProductReviewParams {
445
448
  export interface ReviewDriverParams {
446
449
  navigation?: any,
447
450
  onNavigationRedirect?: any,
448
- order?: { orderId: number, businessId: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
451
+ order?: { orderId: number, business_id: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
449
452
  formState?: any,
450
453
  setIsDriverReviewed?: (isReviewed: boolean) => {},
451
454
  dirverReviews?: any,
452
455
  setDriverReviews?: any,
453
- handleSendDriverReview?: any
456
+ handleSendDriverReview?: any;
457
+ closeReviewDriver?: () => void;
454
458
  }
455
459
  export interface MessagesParams {
456
460
  type?: string,