ordering-ui-react-native 0.16.52 → 0.16.55

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 (34) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  3. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  4. package/themes/original/index.tsx +0 -6
  5. package/themes/original/src/components/AddressForm/index.tsx +6 -5
  6. package/themes/original/src/components/BusinessBasicInformation/index.tsx +197 -142
  7. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  8. package/themes/original/src/components/BusinessController/index.tsx +116 -78
  9. package/themes/original/src/components/BusinessListingSearch/index.tsx +9 -3
  10. package/themes/original/src/components/BusinessProductsListing/index.tsx +42 -13
  11. package/themes/original/src/components/BusinessProductsListing/styles.tsx +5 -0
  12. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +26 -28
  13. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +241 -95
  14. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +46 -2
  15. package/themes/original/src/components/BusinessesListing/index.tsx +35 -62
  16. package/themes/original/src/components/GoogleMap/index.tsx +10 -11
  17. package/themes/original/src/components/OrderDetails/index.tsx +32 -34
  18. package/themes/original/src/components/ProductForm/index.tsx +1 -1
  19. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  20. package/themes/original/src/components/ReviewOrder/index.tsx +79 -99
  21. package/themes/original/src/components/ReviewOrder/styles.tsx +0 -9
  22. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  23. package/themes/original/src/components/{Reviews/ReviewOrder → ReviewTrigger}/styles.tsx +2 -21
  24. package/themes/original/src/components/SingleProductCard/index.tsx +122 -90
  25. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  26. package/themes/original/src/components/shared/OBottomPopup.tsx +5 -2
  27. package/themes/original/src/components/shared/OButton.tsx +2 -0
  28. package/themes/original/src/types/index.tsx +2 -5
  29. package/themes/original/src/components/Reviews/ReviewDriver/index.tsx +0 -301
  30. package/themes/original/src/components/Reviews/ReviewDriver/styles.tsx +0 -39
  31. package/themes/original/src/components/Reviews/ReviewOrder/index.tsx +0 -326
  32. package/themes/original/src/components/Reviews/ReviewProducts/index.tsx +0 -101
  33. package/themes/original/src/components/Reviews/ReviewProducts/styles.tsx +0 -17
  34. package/themes/original/src/components/Reviews/index.tsx +0 -9
@@ -0,0 +1,118 @@
1
+ import React, { useState } from 'react'
2
+ import FontAwesome from 'react-native-vector-icons/FontAwesome';
3
+ import { useLanguage, useUtils } from 'ordering-components/native'
4
+
5
+ import {
6
+ ReviewOrderContainer,
7
+ BusinessLogo,
8
+ FormReviews,
9
+ ActionContainer,
10
+ RatingStarContainer,
11
+ PlacedDate
12
+ } from './styles'
13
+ import { OButton, OIcon, OText } from '../shared'
14
+ import { StyleSheet, View, I18nManager } from 'react-native';
15
+ import { FloatingBottomContainer } from '../../layouts/FloatingBottomContainer'
16
+
17
+ import { useTheme } from 'styled-components/native'
18
+
19
+ export const ReviewTrigger = (props: any) => {
20
+ const {
21
+ order,
22
+ handleOpenOrderReview
23
+ } = props
24
+
25
+ const theme = useTheme()
26
+
27
+ const styles = StyleSheet.create({
28
+ logoWrapper: {
29
+ shadowColor: theme.colors.black,
30
+ shadowRadius: 3,
31
+ shadowOffset: { width: 1, height: 4 },
32
+ elevation: 3,
33
+ borderRadius: 8,
34
+ shadowOpacity: 0.1,
35
+ overflow: 'hidden'
36
+ },
37
+ inputTextArea: {
38
+ borderColor: theme.colors.lightGray,
39
+ borderRadius: 8,
40
+ marginTop: 10,
41
+ marginBottom: 40,
42
+ height: 100,
43
+ alignItems: 'flex-start'
44
+ },
45
+ statusBar: {
46
+ transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
47
+ height: 10,
48
+ borderRadius: 5,
49
+ marginTop: 5
50
+ },
51
+ ratingItemContainer: {
52
+ position: 'absolute',
53
+ top: -20
54
+ },
55
+ ratingItem: {
56
+ left: '-50%',
57
+ flexDirection: 'column',
58
+ alignItems: 'center'
59
+ },
60
+ ratingLineStyle: {
61
+ height: 10,
62
+ width: 1,
63
+ marginBottom: 10,
64
+ backgroundColor: theme.colors.dusk
65
+ },
66
+ reviewedStyle: {
67
+ flexDirection: 'row',
68
+ justifyContent: 'center',
69
+ marginVertical: 20
70
+ },
71
+ })
72
+
73
+ const [, t] = useLanguage()
74
+ const [{ parseDate }] = useUtils()
75
+ const placedOnDate = parseDate(order?.delivery_datetime, { utc: true, outputFormat: 'dddd MMMM DD, YYYY' })
76
+ const [star, setStar] = useState(5)
77
+
78
+ return (
79
+ <>
80
+ <ReviewOrderContainer>
81
+ <BusinessLogo>
82
+ <View style={styles.logoWrapper}>
83
+ <OIcon
84
+ url={order?.logo}
85
+ width={80}
86
+ height={80}
87
+ />
88
+ </View>
89
+ </BusinessLogo>
90
+ {!!order?.business_name && <OText style={{ textAlign: 'center', marginTop: 15 }} color={theme.colors.textNormal}>{order?.business_name}</OText>}
91
+ <View style={{ flex: 1, justifyContent: 'flex-end' }}>
92
+ <FormReviews>
93
+ <RatingStarContainer>
94
+ {[...Array(5).keys()].map((index: number) => (<FontAwesome name={(index <= (star - 1)) ? 'star' : 'star-o'} size={28} key={`star-symbol-${index}`} onPress={() => setStar(index + 1)} color={theme?.colors?.primary} />)
95
+ )}
96
+ </RatingStarContainer>
97
+ <PlacedDate>
98
+ <OText color={theme.colors.textNormal}>{t('DONOT_FORGET_RATE_YOUR_ORDER', 'Do not forget to rate your order placed on ')}</OText>
99
+ <OText color={theme.colors.textNormal} style={{ fontWeight: "bold" }}>{placedOnDate}</OText>
100
+ </PlacedDate>
101
+ </FormReviews>
102
+ </View>
103
+ </ReviewOrderContainer>
104
+ <FloatingBottomContainer>
105
+ <ActionContainer>
106
+ <OButton
107
+ textStyle={{ color: theme.colors.white, paddingRight: 10 }}
108
+ text={t('GOTO_REVIEW', 'Go to review')}
109
+ style={{ borderRadius: 8 }}
110
+ imgRightSrc={theme.images.general.arrow_right}
111
+ imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
112
+ onClick={() => handleOpenOrderReview(star)}
113
+ />
114
+ </ActionContainer>
115
+ </FloatingBottomContainer>
116
+ </>
117
+ )
118
+ }
@@ -16,32 +16,13 @@ export const FormReviews = styled.View`
16
16
  margin-top: 30px;
17
17
  `
18
18
 
19
- export const CommentsButtonGroup = styled.View`
20
- flex-direction: row;
21
- flex-wrap: wrap;
22
- `
23
-
24
19
  export const ActionContainer = styled.View`
25
20
  flex-direction: row;
26
21
  align-items: center;
27
- justify-content: space-between;
22
+ justify-content: center;
28
23
  padding: 3px 30px;
29
24
  `
30
25
 
31
- export const SkipButton = styled.TouchableOpacity`
32
- `
33
-
34
- export const RatingBarContainer = styled.View`
35
- margin-top: 10px;
36
- margin-bottom: 25px;
37
- `
38
-
39
- export const RatingTextContainer = styled.View`
40
- flex-direction: row;
41
- align-items: center;
42
- justify-content: space-between;
43
- margin-top: 10px;
44
- `
45
26
  export const RatingStarContainer = styled.View`
46
27
  flex-direction: row;
47
28
  align-items: center;
@@ -50,4 +31,4 @@ export const RatingStarContainer = styled.View`
50
31
  `
51
32
  export const PlacedDate = styled.View`
52
33
  margin-top: 30px;
53
- `
34
+ `
@@ -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;
@@ -120,110 +122,140 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
120
122
  }
121
123
 
122
124
  return (
123
- <InView style={{ minHeight: 140 }} triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(true)}>
124
- {isIntersectionObserver && (
125
+ <InView style={{ minHeight: 200 }} triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(true)}>
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>
243
+ ) : (
244
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
245
+ <View style={{ flexDirection: 'row' }}>
246
+ <PlaceholderLine
247
+ width={24}
248
+ height={70}
249
+ style={{ marginRight: 10, marginBottom: 10 }}
250
+ />
251
+ <Placeholder style={{ paddingVertical: 10 }}>
252
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
253
+ <PlaceholderLine width={20} />
254
+ </Placeholder>
255
+ </View>
256
+ </Placeholder>
225
257
  )}
226
- </InView >
258
+ </InView>
227
259
  );
228
260
  }, SingleProductCardPropsAreEqual);
229
261
 
@@ -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
  `
@@ -6,6 +6,7 @@ const deviceHeight = Dimensions.get('window').height
6
6
 
7
7
  interface Props {
8
8
  open: boolean;
9
+ transparent?: boolean;
9
10
  title?: string;
10
11
  children?: any;
11
12
  onClose?: any;
@@ -17,6 +18,7 @@ interface Props {
17
18
  const OBottomPopup = (props: Props) => {
18
19
  const {
19
20
  open,
21
+ transparent,
20
22
  title,
21
23
  onClose,
22
24
  children,
@@ -26,10 +28,11 @@ const OBottomPopup = (props: Props) => {
26
28
  closeIcon
27
29
  } = props
28
30
  const { top, bottom } = useSafeAreaInsets();
31
+
29
32
  return (
30
33
  <Modal
31
34
  animationType='slide'
32
- transparent={false}
35
+ transparent={transparent}
33
36
  visible={open}
34
37
  onRequestClose={() => onClose()}
35
38
  presentationStyle={'fullScreen'}
@@ -69,7 +72,7 @@ const styles = StyleSheet.create({
69
72
  container: {
70
73
  flex: 1,
71
74
  backgroundColor: '#000000AA',
72
- justifyContent: 'flex-end',
75
+ justifyContent: 'flex-end'
73
76
  },
74
77
  touchableOutsideStyle: {
75
78
  flex: 1,
@@ -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,8 +417,9 @@ export interface ProductItemAccordionParams {
417
417
  isFromCheckout?: any
418
418
  }
419
419
  export interface ReviewOrderParams {
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 };
420
+ order?: { id: number, business_id: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any };
421
421
  stars?: any;
422
+ defaultStar?: number;
422
423
  handleChangeInput?: any;
423
424
  handleChangeRating?: any;
424
425
  handleSendReview?: any;
@@ -428,8 +429,6 @@ export interface ReviewOrderParams {
428
429
  handleReviewState?: any;
429
430
  setStars?: any;
430
431
  onNavigationRedirect?: any;
431
- closeReviewOrder?: () => void;
432
- skipReview?: () => void;
433
432
  }
434
433
  export interface ReviewProductParams {
435
434
  navigation?: any,
@@ -438,7 +437,6 @@ export interface ReviewProductParams {
438
437
  formState?: any,
439
438
  handleChangeFormState?: any,
440
439
  handleSendProductReview?: any;
441
- closeReviewProduct?: () => void;
442
440
  }
443
441
  export interface SingleProductReviewParams {
444
442
  product: any,
@@ -454,7 +452,6 @@ export interface ReviewDriverParams {
454
452
  dirverReviews?: any,
455
453
  setDriverReviews?: any,
456
454
  handleSendDriverReview?: any;
457
- closeReviewDriver?: () => void;
458
455
  }
459
456
  export interface MessagesParams {
460
457
  type?: string,