ordering-ui-react-native 0.17.85 → 0.17.87

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 (33) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/MapView/index.tsx +2 -2
  3. package/themes/business/src/components/ProductItemAccordion/index.tsx +21 -3
  4. package/themes/original/src/components/AddressForm/index.tsx +26 -22
  5. package/themes/original/src/components/BusinessBasicInformation/index.tsx +91 -70
  6. package/themes/original/src/components/BusinessController/index.tsx +71 -49
  7. package/themes/original/src/components/BusinessProductsListing/index.tsx +32 -44
  8. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +48 -30
  9. package/themes/original/src/components/Cart/index.tsx +36 -71
  10. package/themes/original/src/components/CartContent/index.tsx +47 -2
  11. package/themes/original/src/components/CartContent/styles.tsx +10 -0
  12. package/themes/original/src/components/Checkout/index.tsx +40 -32
  13. package/themes/original/src/components/Messages/index.tsx +8 -7
  14. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  15. package/themes/original/src/components/MultiCheckout/index.tsx +2 -7
  16. package/themes/original/src/components/MyOrders/index.tsx +9 -7
  17. package/themes/original/src/components/OrderDetails/index.tsx +99 -73
  18. package/themes/original/src/components/OrderTypeSelector/index.tsx +6 -4
  19. package/themes/original/src/components/PageBanner/index.tsx +60 -33
  20. package/themes/original/src/components/PageBanner/styles.tsx +0 -7
  21. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  22. package/themes/original/src/components/ProductForm/index.tsx +2 -2
  23. package/themes/original/src/components/SingleOrderCard/index.tsx +58 -44
  24. package/themes/original/src/components/SingleProductCard/index.tsx +51 -21
  25. package/themes/original/src/components/SingleProductCard/styles.tsx +11 -1
  26. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  27. package/themes/original/src/components/UpsellingProducts/index.tsx +243 -216
  28. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  29. package/themes/original/src/components/UserProfile/index.tsx +82 -53
  30. package/themes/original/src/components/shared/OButton.tsx +5 -1
  31. package/themes/original/src/components/shared/OInput.tsx +8 -2
  32. package/themes/original/src/types/index.tsx +3 -0
  33. package/themes/original/src/utils/index.tsx +11 -0
@@ -151,7 +151,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
151
151
  order: {
152
152
  id: order?.id,
153
153
  business_id: order?.business_id,
154
- logo: order?.business?.length > 1 ? order?.business?.map?.((business : any) => business?.logo): order?.business?.logo,
154
+ logo: order?.business?.length > 1 ? order?.business?.map?.((business: any) => business?.logo) : order?.business?.logo,
155
155
  driver: order?.driver,
156
156
  products: order?.products,
157
157
  review: order?.review,
@@ -174,7 +174,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
174
174
  handleClickOrder(order?.uuid)
175
175
  return
176
176
  }
177
- if (order?.cart_group_id){
177
+ if (order?.cart_group_id) {
178
178
  onNavigationRedirect?.('MultiOrdersDetails', { orderId: order?.cart_group_id });
179
179
  } else {
180
180
  onNavigationRedirect?.('OrderDetails', { orderId: order?.uuid });
@@ -189,6 +189,15 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
189
189
  setConfirm({ ...confirm, open: false, title: null })
190
190
  }
191
191
 
192
+ const hideBusinessLogo = theme?.orders?.components?.business_logo?.hidden
193
+ const hideDate = theme?.orders?.components?.date?.hidden
194
+ const hideBusinessName = theme?.orders?.components?.business_name?.hidden
195
+ const hideOrderNumber = theme?.orders?.components?.order_number?.hidden
196
+ const hideReviewOrderButton = theme?.orders?.components?.review_order_button?.hidden
197
+ const hideReorderButton = theme?.orders?.components?.reorder_button?.hidden
198
+ const hideFavorite = theme?.orders?.components?.favorite?.hidden
199
+ const hideOrderStatus = theme?.orders?.components?.order_status?.hidden
200
+
192
201
  return (
193
202
  <>
194
203
  <CardAnimation
@@ -196,28 +205,26 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
196
205
  style={[styles.container]}
197
206
  >
198
207
  <InnerContainer>
199
- {(!!order.business?.logo || theme?.images?.dummies?.businessLogo) && (
208
+ {!hideBusinessLogo && (!!order.business?.logo || theme?.images?.dummies?.businessLogo) && (
200
209
  <>
201
210
  {order?.business?.length > 1 ? (
202
211
  <MultiLogosContainer>
203
- {order?.business?.map((business: any, i: number) => (
204
- <View key={business?.id}>
205
- {i > 1 ? (
206
- <>
207
- {console.log(order?.business?.length - 2)}
208
- <OText mRight={3}> + {order?.business?.length - 2}</OText>
209
- </>
210
- ) : (
211
- <Logo style={styles.logoWrapper} isMulti>
212
- <OIcon
213
- url={optimizeImage(business?.logo, 'h_300,c_limit')}
214
- src={optimizeImage(!business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
215
- style={styles.minilogo}
216
- />
217
- </Logo>
218
- )}
219
- </View>
212
+ {order?.business?.map((business: any, i: number) => i < 2 && (
213
+ <Logo
214
+ isMulti
215
+ key={business?.id}
216
+ style={styles.logoWrapper}
217
+ >
218
+ <OIcon
219
+ url={optimizeImage(business?.logo, 'h_300,c_limit')}
220
+ src={optimizeImage(!business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
221
+ style={styles.minilogo}
222
+ />
223
+ </Logo>
220
224
  ))}
225
+ {order?.business?.length > 1 && (order?.business?.length - 2) > 0 && (
226
+ <OText mRight={3}> + {order?.business?.length - 2}</OText>
227
+ )}
221
228
  </MultiLogosContainer>
222
229
  ) : (
223
230
  <Logo style={styles.logoWrapper}>
@@ -232,11 +239,13 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
232
239
  )}
233
240
  <CardInfoWrapper>
234
241
  <ContentHeader>
235
- <View style={{ flex: 1 }}>
236
- <OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
237
- {order?.business?.length > 1 ? `${t('GROUP_ORDER', 'Group Order')} ${t('No', 'No')}. ${order?.cart_group_id}` : order.business?.name}
238
- </OText>
239
- </View>
242
+ {(order?.business?.length > 1 && !hideOrderNumber) || (!order?.business?.length && !hideBusinessName) && (
243
+ <View style={{ flex: 1 }}>
244
+ <OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
245
+ {order?.business?.length > 1 ? `${t('GROUP_ORDER', 'Group Order')} ${t('No', 'No')}. ${order?.cart_group_id}` : order.business?.name}
246
+ </OText>
247
+ </View>
248
+ )}
240
249
  {!!!pastOrders && (
241
250
  <>
242
251
  {isMessageView ? (
@@ -260,7 +269,8 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
260
269
  )}
261
270
  {!!pastOrders && (
262
271
  <ButtonWrapper>
263
- {allowedOrderStatus.includes(parseInt(order?.status)) &&
272
+ {!hideReviewOrderButton &&
273
+ allowedOrderStatus.includes(parseInt(order?.status)) &&
264
274
  !order.review && (
265
275
  <TouchableOpacity
266
276
  onPress={() => handleClickOrderReview(order)}
@@ -270,7 +280,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
270
280
  </OText>
271
281
  </TouchableOpacity>
272
282
  )}
273
- {order.cart && (
283
+ {order.cart && !hideReorderButton && (
274
284
  <OButton
275
285
  text={t('REORDER', 'Reorder')}
276
286
  imgRightSrc={''}
@@ -290,7 +300,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
290
300
  <ContentFooter>
291
301
  <View style={{ flex: 1 }}>
292
302
  <View style={styles.infoText}>
293
- {(!!!pastOrders || order?.business?.length > 1) && (
303
+ {(!!!pastOrders || order?.business?.length > 1) && !hideOrderNumber && (
294
304
  <>
295
305
  <OText
296
306
  size={10}
@@ -313,28 +323,32 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
313
323
  </OText>
314
324
  </>
315
325
  )}
326
+ {!hideDate && (
327
+ <OText
328
+ size={10}
329
+ lineHeight={15}
330
+ color={theme.colors.textSecondary}
331
+ style={{ marginVertical: 3 }}
332
+ numberOfLines={1}>
333
+ {
334
+ pastOrders
335
+ ? order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })
336
+ : order?.eta_time + 'min'
337
+ }
338
+ </OText>
339
+ )}
340
+ </View>
341
+ {!hideOrderStatus && (
316
342
  <OText
343
+ color={theme.colors.primary}
317
344
  size={10}
318
345
  lineHeight={15}
319
- color={theme.colors.textSecondary}
320
- style={{ marginVertical: 3 }}
321
346
  numberOfLines={1}>
322
- {
323
- pastOrders
324
- ? order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })
325
- : order?.eta_time + 'min'
326
- }
347
+ {getOrderStatus(order.status)?.value}
327
348
  </OText>
328
- </View>
329
- <OText
330
- color={theme.colors.primary}
331
- size={10}
332
- lineHeight={15}
333
- numberOfLines={1}>
334
- {getOrderStatus(order.status)?.value}
335
- </OText>
349
+ )}
336
350
  </View>
337
- {!isMessageView && !order?.business?.length && (
351
+ {!isMessageView && !order?.business?.length && !hideFavorite && (
338
352
  <LottieAnimation
339
353
  type='favorite'
340
354
  onClick={handleChangeFavorite}
@@ -11,7 +11,7 @@ import {
11
11
  } from 'ordering-components/native';
12
12
  import { useTheme } from 'styled-components/native';
13
13
  import { SingleProductCardParams } from '../../types';
14
- import { CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
14
+ import { CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper, WrapTags, TagsContainer } from './styles';
15
15
  import { StyleSheet, View } from 'react-native';
16
16
  import { InView } from 'react-native-intersection-observer'
17
17
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
@@ -39,14 +39,19 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
39
39
  enableIntersection,
40
40
  navigation,
41
41
  businessId,
42
- isPreviously
42
+ isPreviously,
43
+ viewString
43
44
  } = props;
44
45
 
45
46
  const theme = useTheme();
46
47
  const hideAddButton = theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden ?? true
47
48
  const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
48
-
49
+ const hideProductDescription = theme?.business_view?.components?.products?.components?.product?.components?.description?.hidden
50
+ const hideProductLogo = viewString
51
+ ? theme?.[viewString]?.components?.cart?.components?.products?.image?.hidden
52
+ : theme?.business_view?.components?.products?.components?.product?.components?.image?.hidden
49
53
  const textSize = isChewLayout ? 12 : 10
54
+ const logoPosition = theme?.business_view?.components?.products?.components?.product?.components?.image?.position
50
55
 
51
56
  const styles = StyleSheet.create({
52
57
  container: {
@@ -100,6 +105,11 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
100
105
  textDecorationLine: 'line-through',
101
106
  marginLeft: 7,
102
107
  marginRight: 7
108
+ },
109
+ productTagsStyle: {
110
+ width: 30,
111
+ height: 30,
112
+ marginRight: 5
103
113
  }
104
114
  });
105
115
 
@@ -168,7 +178,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
168
178
  (style && { ...style })
169
179
  ]}
170
180
  >
171
- <View style={{ flexDirection: 'row' }}>
181
+ <View style={{ flexDirection: logoPosition === 'left' ? 'row-reverse' : 'row' }}>
172
182
  {productAddedToCartLength > 0 && (
173
183
  <QuantityContainer style={[styles.quantityContainer, {
174
184
  transform: [{ translateX: 25 }, { translateY: -25 }],
@@ -205,15 +215,33 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
205
215
  {product?.offer_price !== null && !!product?.in_offer && (
206
216
  <OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
207
217
  )}
218
+ {product?.tags && product?.tags.length > 0 && (
219
+ <WrapTags>
220
+ {product?.tags.map((tag: any, i: any) => (
221
+ <TagsContainer key={i}>
222
+ <FastImage
223
+ style={styles.productTagsStyle}
224
+ source={tag.image ? {
225
+ uri: optimizeImage(tag.image, 'h_250,c_limit'),
226
+ priority: FastImage.priority.normal,
227
+ } : theme?.images?.dummies?.product}
228
+ resizeMode={FastImage.resizeMode.cover}
229
+ />
230
+ </TagsContainer>
231
+ ))}
232
+ </WrapTags>
233
+ )}
208
234
  </PricesContainer>
209
- <OText
210
- size={textSize}
211
- numberOfLines={!isPreviously ? 2 : 1}
212
- ellipsizeMode="tail"
213
- color={theme.colors.textSecondary}
214
- style={styles.line15}>
215
- {product?.description}
216
- </OText>
235
+ {!hideProductDescription && (
236
+ <OText
237
+ size={textSize}
238
+ numberOfLines={!isPreviously ? 2 : 1}
239
+ ellipsizeMode="tail"
240
+ color={theme.colors.textSecondary}
241
+ style={styles.line15}>
242
+ {product?.description}
243
+ </OText>
244
+ )}
217
245
  {isPreviously && (
218
246
  <OText
219
247
  size={textSize}
@@ -225,7 +253,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
225
253
  </OText>
226
254
  )}
227
255
  </CardInfo>
228
- <LogoWrapper>
256
+ <LogoWrapper logoPosition={logoPosition}>
229
257
  {!!product?.ribbon?.enabled && (
230
258
  <RibbonBox
231
259
  bgColor={product?.ribbon?.color}
@@ -244,14 +272,16 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
244
272
  </OText>
245
273
  </RibbonBox>
246
274
  )}
247
- <FastImage
248
- style={styles.productStyle}
249
- source={product?.images ? {
250
- uri: optimizeImage(product?.images, 'h_250,c_limit'),
251
- priority: FastImage.priority.normal,
252
- } : theme?.images?.dummies?.product}
253
- resizeMode={FastImage.resizeMode.cover}
254
- />
275
+ {!hideProductLogo && (
276
+ <FastImage
277
+ style={styles.productStyle}
278
+ source={product?.images ? {
279
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
280
+ priority: FastImage.priority.normal,
281
+ } : theme?.images?.dummies?.product}
282
+ resizeMode={FastImage.resizeMode.cover}
283
+ />
284
+ )}
255
285
  </LogoWrapper>
256
286
 
257
287
  {(isSoldOut || maxProductQuantity <= 0) && (
@@ -27,7 +27,17 @@ export const PricesContainer = styled.View`
27
27
 
28
28
  export const LogoWrapper = styled.View`
29
29
  position: relative;
30
- margin-left: 12px;
30
+ margin-left: ${(props) => !props.logoPosition || props.logoPosition === 'right' ? '12px' : '0px'};
31
+ margin-right: ${(props) => props.logoPosition === 'right' ? '0px' : '12px'};
32
+ `
33
+ export const WrapTags = styled.View`
34
+ display: flex;
35
+ flex-direction: row;
36
+ margin-left: 10px;
37
+ `
38
+ export const TagsContainer = styled.View`
39
+ display: flex;
40
+ margin: auto;
31
41
  `
32
42
 
33
43
  export const RibbonBox = styled.View`
@@ -128,7 +128,7 @@ const styles = StyleSheet.create({
128
128
  },
129
129
  cardsList: {
130
130
  width: '100%',
131
- maxHeight: 130
131
+ maxHeight: 150
132
132
  },
133
133
  })
134
134