ordering-ui-react-native 0.17.87 → 0.17.89

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.17.87",
3
+ "version": "0.17.89",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -78,8 +78,7 @@ const MultiCheckoutUI = (props: any) => {
78
78
 
79
79
  const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
80
80
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
81
- const maximumCarts = 5
82
- const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || openCarts.length > maximumCarts || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
81
+ const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
83
82
  const walletCarts = (Object.values(carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && cart?.wallets) || null) || []
84
83
 
85
84
  const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
@@ -292,11 +291,6 @@ const MultiCheckoutUI = (props: any) => {
292
291
  </OText>
293
292
  </ChCartsTotal>
294
293
  )}
295
- {openCarts.length > maximumCarts && (
296
- <OText size={14} color={theme.colors.danger5} style={{ marginVertical: 20 }}>
297
- {t('WARNING_MAXIMUM_CARTS', 'You can only pay for a maximum of 5 carts, please discard one or more to continue.')}
298
- </OText>
299
- )}
300
294
  </ChCarts>
301
295
  </ChSection>
302
296
  </ChContainer>
@@ -70,23 +70,25 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
70
70
  const _orders = customArray || values || []
71
71
  const uniqueOrders: any = []
72
72
 
73
-
74
73
  useEffect(() => {
75
74
  if (loading || error) return
76
75
  const ordersReduced = _orders.map((order: any) => order?.cart_group_id
77
- ? _orders
78
- ?.filter((_order : any) => _order?.cart_group_id === order?.cart_group_id)
79
- ?.reduce((orderCompleted : any, currentOrder : any) => ({
80
- ...orderCompleted,
81
- total: orderCompleted.summary?.total + currentOrder?.summary?.total,
82
- business: [orderCompleted.business, currentOrder.business].flat(),
83
- business_id: [orderCompleted.business_id, currentOrder.business_id].flat(),
84
- id: [orderCompleted.id, currentOrder.id].flat(),
85
- review: orderCompleted.review && currentOrder.review,
86
- user_review: orderCompleted.user_review && currentOrder.user_review,
87
- products: [orderCompleted.products, currentOrder.products].flat()
88
- }))
89
- : order)
76
+ ? _orders
77
+ .filter((_order: any) => _order?.cart_group_id === order?.cart_group_id)
78
+ .map((_o: any, _: any, _ordersList: any) => {
79
+ const obj = {
80
+ ..._o,
81
+ id: _ordersList.map(o => o.id),
82
+ review: _o.review,
83
+ user_review: _o.user_review,
84
+ total: _ordersList.reduce((acc: any, o: any) => acc + o.summary.total, 0),
85
+ business: _ordersList.map((o: any) => o.business),
86
+ business_id: _ordersList.map((o: any) => o.business_id),
87
+ products: _ordersList.map((o: any) => o.products)
88
+ }
89
+ return obj
90
+ }).find((o: any) => o)
91
+ : order)
90
92
  const orders = ordersReduced?.filter((order: any) => {
91
93
  if (!order?.cart_group_id) return true
92
94
  const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
@@ -11,8 +11,8 @@ 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, WrapTags, TagsContainer } from './styles';
15
- import { StyleSheet, View } from 'react-native';
14
+ import { CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper, TagsContainer } from './styles';
15
+ import { ScrollView, StyleSheet, TouchableWithoutFeedback, View } from 'react-native';
16
16
  import { InView } from 'react-native-intersection-observer'
17
17
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
18
18
  import { OButton, OIcon, OText } from '../shared';
@@ -104,7 +104,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
104
104
  color: '#808080',
105
105
  textDecorationLine: 'line-through',
106
106
  marginLeft: 7,
107
- marginRight: 7
107
+ marginRight: 0
108
108
  },
109
109
  productTagsStyle: {
110
110
  width: 30,
@@ -215,21 +215,29 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
215
215
  {product?.offer_price !== null && !!product?.in_offer && (
216
216
  <OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
217
217
  )}
218
- {product?.tags && product?.tags.length > 0 && (
219
- <WrapTags>
218
+ {!isPreviously && product?.tags && product?.tags.length > 0 && (
219
+ <ScrollView
220
+ showsVerticalScrollIndicator={false}
221
+ showsHorizontalScrollIndicator={false}
222
+ horizontal
223
+ style={{ marginLeft: 10 }}
224
+ contentContainerStyle={{flexGrow: 1}}
225
+ >
220
226
  {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>
227
+ <TouchableWithoutFeedback key={i}>
228
+ <TagsContainer>
229
+ <FastImage
230
+ style={styles.productTagsStyle}
231
+ source={tag.image ? {
232
+ uri: optimizeImage(tag.image, 'h_250,c_limit'),
233
+ priority: FastImage.priority.normal,
234
+ } : theme?.images?.dummies?.product}
235
+ resizeMode={FastImage.resizeMode.cover}
236
+ />
237
+ </TagsContainer>
238
+ </TouchableWithoutFeedback>
231
239
  ))}
232
- </WrapTags>
240
+ </ScrollView>
233
241
  )}
234
242
  </PricesContainer>
235
243
  {!hideProductDescription && (
@@ -33,6 +33,7 @@ export const LogoWrapper = styled.View`
33
33
  export const WrapTags = styled.View`
34
34
  display: flex;
35
35
  flex-direction: row;
36
+ justify-content: flex-start;
36
37
  margin-left: 10px;
37
38
  `
38
39
  export const TagsContainer = styled.View`