ordering-ui-react-native 0.16.72 → 0.16.74

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.16.72",
3
+ "version": "0.16.74",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -371,7 +371,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
371
371
  handleCustomClick={() => onBusinessClick(business)}
372
372
  handleUpdateBusinessList={handleUpdateBusinessList}
373
373
  orderType={orderState?.options?.type}
374
- style={{ width: screenWidth - 80, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
374
+ style={{ width: screenWidth - 120, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
375
375
  />
376
376
  ))}
377
377
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
@@ -433,7 +433,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
433
433
  style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
434
434
  />
435
435
  </SingleBusinessContainer>
436
- <ScrollView horizontal style={styles.productsContainer}>
436
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
437
437
  {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
438
438
  <SingleProductCard
439
439
  key={product?.id}
@@ -443,7 +443,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
443
443
  onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
444
444
  productAddedToCartLength={0}
445
445
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
446
- style={{ width: screenWidth - 80, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
446
+ style={{ width: screenWidth - 120, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
447
447
  />
448
448
  )))}
449
449
 
@@ -136,7 +136,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
136
136
  <SingleProductCard
137
137
  key={'prod_' + product.id + `_${i}`}
138
138
  isSoldOut={product.inventoried && !product.quantity}
139
- enableIntersection
139
+ enableIntersection={!isFiltMode}
140
140
  product={product}
141
141
  businessId={businessId}
142
142
  categoryState={categoryState}
@@ -164,7 +164,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
164
164
  key={'feat_' + product.id + `_${i}`}
165
165
  isSoldOut={product.inventoried && !product.quantity}
166
166
  product={product}
167
- enableIntersection
167
+ enableIntersection={!isFiltMode}
168
168
  businessId={businessId}
169
169
  categoryState={categoryState}
170
170
  onProductClick={onProductClick}
@@ -257,7 +257,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
257
257
  {products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
258
258
  <SingleProductCard
259
259
  key={`${product?.id}_${i}`}
260
- enableIntersection
260
+ enableIntersection={!isFiltMode}
261
261
  isSoldOut={product.inventoried && !product.quantity}
262
262
  businessId={businessId}
263
263
  product={product}
@@ -279,19 +279,24 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
279
279
  <>
280
280
  {[...Array(categoryState?.pagination?.nextPageItems).keys()].map(
281
281
  (item, i) => (
282
- <Placeholder key={i} style={{ padding: 5 }} Animation={Fade}>
283
- <View style={{ flexDirection: 'row' }}>
282
+ <View style={{ minHeight: 165, marginBottom: 28, padding: 12 }}>
283
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
284
+ <View style={{ flexDirection: 'row' }}>
285
+ <Placeholder style={{ paddingVertical: 10, flex: 1 }}>
286
+ <PlaceholderLine width={60} style={{ marginBottom: 15 }} />
287
+ <PlaceholderLine width={20} />
288
+ </Placeholder>
289
+ <PlaceholderLine
290
+ width={24}
291
+ height={70}
292
+ style={{ marginLeft: 10, marginBottom: 10 }}
293
+ />
294
+ </View>
284
295
  <PlaceholderLine
285
- width={24}
286
- height={70}
287
- style={{ marginRight: 10, marginBottom: 10 }}
296
+ height={52}
288
297
  />
289
- <Placeholder style={{ paddingVertical: 10 }}>
290
- <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
291
- <PlaceholderLine width={20} />
292
- </Placeholder>
293
- </View>
294
- </Placeholder>
298
+ </Placeholder>
299
+ </View>
295
300
  ),
296
301
  )}
297
302
  </>
@@ -127,7 +127,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
127
127
  const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
128
128
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
129
129
  const isOpenFiltProducts = isOpenSearchBar && !!searchValue
130
- const filtProductsHeight = Platform.OS === 'ios' ? 0 : 35
130
+ const filtProductsHeight = Platform.OS === 'ios' ? 0 : 100
131
131
  const onRedirect = (route: string, params?: any) => {
132
132
  navigation.navigate(route, params)
133
133
  }
@@ -246,7 +246,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
246
246
  <TopHeader isIos={Platform.OS === 'ios'}>
247
247
  {!isOpenSearchBar && (
248
248
  <>
249
- <View style={{ ...styles.headerItem, flex: 1 }}>
249
+ <View style={{ ...styles.headerItem, width: 175 }}>
250
250
  <OButton
251
251
  imgLeftSrc={theme.images.general.arrow_left}
252
252
  imgRightSrc={null}
@@ -314,6 +314,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
314
314
  style={{
315
315
  height: Dimensions.get('window').height - filtProductsHeight
316
316
  }}
317
+ contentContainerStyle={{ flexGrow: 1 }}
317
318
  >
318
319
  <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
319
320
  <BusinessProductsList
@@ -352,7 +353,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
352
353
  <BackgroundGray />
353
354
  )}
354
355
  <IOScrollView
355
- stickyHeaderIndices={[2]}
356
+ stickyHeaderIndices={[business?.professionals?.length > 0 ? 3 : 2]}
356
357
  style={{
357
358
  ...styles.mainContainer,
358
359
  marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
@@ -394,26 +395,21 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
394
395
  marginTop: isChewLayout && showLogo ? 10 : 0
395
396
  }}
396
397
  />
397
- {!loading && business?.id && (
398
- <>
399
- {!(business?.categories?.length === 0) && (
400
- <BusinessProductsCategories
401
- categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
402
- categorySelected={categorySelected}
403
- onClickCategory={handleChangeCategory}
404
- featured={featuredProducts}
405
- openBusinessInformation={openBusinessInformation}
406
- scrollViewRef={scrollViewRef}
407
- productListLayout={productListLayout}
408
- categoriesLayout={categoriesLayout}
409
- selectedCategoryId={selectedCategoryId}
410
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
411
- setSelectedCategoryId={setSelectedCategoryId}
412
- setCategoryClicked={setCategoryClicked}
413
-
414
- />
415
- )}
416
- </>
398
+ {!loading && business?.id && !(business?.categories?.length === 0) && (
399
+ <BusinessProductsCategories
400
+ categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
401
+ categorySelected={categorySelected}
402
+ onClickCategory={handleChangeCategory}
403
+ featured={featuredProducts}
404
+ openBusinessInformation={openBusinessInformation}
405
+ scrollViewRef={scrollViewRef}
406
+ productListLayout={productListLayout}
407
+ categoriesLayout={categoriesLayout}
408
+ selectedCategoryId={selectedCategoryId}
409
+ lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
410
+ setSelectedCategoryId={setSelectedCategoryId}
411
+ setCategoryClicked={setCategoryClicked}
412
+ />
417
413
  )}
418
414
  {!loading && business?.id && (
419
415
  <>
@@ -464,31 +464,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
464
464
  />
465
465
  </OrderTypesContainer>
466
466
  )}
467
- {!businessId && (
468
- <SearchBar
469
- forwardRef={searchBarRef}
470
- onSearch={handleChangeSearch}
471
- searchValue={searchValue}
472
- lazyLoad
473
- hideIcon
474
- isCancelXButtonShow={!!searchValue}
475
- onCancel={() => handleChangeSearch('')}
476
- placeholder={t('SEARCH', 'Search')}
477
- height={50}
478
- isDisabled={true}
479
- inputContainerStyles={styles.inputContainerStyles}
480
- containerStyles={{
481
- marginHorizontal: 40,
482
- marginTop: 20
483
- }}
484
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? { paddingBottom: 6 } : { paddingBottom: 4 } }}
485
- onPress={() => { navigation.navigate('BusinessSearch', { businessTypes }) }}
486
- onSubmitEditing={() => { navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
487
- />
488
- )}
489
467
 
490
468
  {!hideCities && (
491
- <View style={{ marginTop: 10 }}>
469
+ <View style={{ marginTop: 20 }}>
492
470
  <TouchableOpacity
493
471
  style={styles.buttonCityStyle}
494
472
  onPress={() => setIsOpenCities(true)}
@@ -119,14 +119,31 @@ export const MyOrders = (props: any) => {
119
119
  </View>
120
120
  </>
121
121
  )}
122
- {notOrderOptions.includes(selectedOption) && (
122
+ {selectedOption === 'business' && (
123
123
  <OrdersOption
124
124
  {...props}
125
+ isBusiness
126
+ titleContent={t('PREVIOUSLY_ORDERED', 'Previously ordered')}
127
+ hideOrders
128
+ horizontal
129
+ activeOrders
130
+ pastOrders
131
+ preOrders
132
+ businessesSearchList={businessesSearchList}
133
+ setIsEmptyBusinesses={setIsEmptyBusinesses}
134
+ businessOrderIds={businessOrderIds}
135
+ setBusinessOrderIds={setBusinessOrderIds}
136
+ ordersLength={ordersLength}
137
+ setOrdersLength={setOrdersLength}
138
+ />
139
+ )}
140
+ {selectedOption === 'products' && (
141
+ <OrdersOption
142
+ {...props}
143
+ isProducts
125
144
  titleContent={t('PREVIOUSLY_ORDERED', 'Previously ordered')}
126
145
  hideOrders
127
146
  horizontal
128
- isBusiness={selectedOption === 'business'}
129
- isProducts={selectedOption === 'products'}
130
147
  activeOrders
131
148
  pastOrders
132
149
  preOrders
@@ -123,7 +123,7 @@ export const PreviousBusinessOrderedUI = (props: PreviousBusinessOrderedParams)
123
123
  <>
124
124
  {!businessLoading && (
125
125
  <BusinessControllerList
126
- style={{ width: windowWidth - 80, marginRight: 20 }}
126
+ style={{ width: windowWidth - 120, marginRight: 20 }}
127
127
  />
128
128
  )}
129
129
  </>
@@ -189,15 +189,18 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
189
189
  )}
190
190
  {(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
191
191
  <>
192
- <OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
193
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
194
- {titleContent || (activeOrders
195
- ? t('ACTIVE', 'Active')
196
- : preOrders
197
- ? t('PREORDERS', 'Preorders')
198
- : t('PAST', 'Past'))}
199
- </OText>
200
- </OptionTitle>
192
+ {((titleContent && ((isBusiness && businessOrderIds?.length > 0) || isProducts)) || !titleContent) && (
193
+ <OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
194
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
195
+ {titleContent || (activeOrders
196
+ ? t('ACTIVE', 'Active')
197
+ : preOrders
198
+ ? t('PREORDERS', 'Preorders')
199
+ : t('PAST', 'Past'))}
200
+ </OText>
201
+ </OptionTitle>
202
+ )}
203
+
201
204
  {!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
202
205
  !loading &&
203
206
  orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
@@ -210,7 +213,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
210
213
  )}
211
214
  </>
212
215
  )}
213
- {isBusiness && !!businessesSearchList && businessLoading && (
216
+ {isBusiness && !!businessesSearchList && businessLoading && businessOrderIds?.length > 0 && (
214
217
  <ScrollView horizontal>
215
218
  <BusinessControllerSkeletons />
216
219
  </ScrollView>
@@ -98,6 +98,10 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
98
98
 
99
99
  const onChangeSpot = () => {
100
100
  if (orderState.loading) return
101
+ if (!Number.isInteger(Number(spotNumber))) {
102
+ showToast(ToastType.Error, t('VALIDATION_ERROR_INTEGER', 'The _attribute_ must be an integer.').replace('_attribute_', placeholderText))
103
+ return
104
+ }
101
105
  const isVehicle = Object.values(vehicle).every(e => e)
102
106
  const bodyToSend: any = {}
103
107
  spotNumber && (bodyToSend.spot_number = spotNumber)
@@ -126,7 +130,7 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
126
130
 
127
131
  useEffect(() => {
128
132
  if (spotState?.error?.length > 0) {
129
- const errorText = manageErrorsToShow(spotState?.errors)
133
+ const errorText = manageErrorsToShow(spotState?.error)
130
134
  showToast(ToastType.Error, errorText)
131
135
  }
132
136
  }, [spotState?.error])
@@ -211,7 +215,7 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
211
215
  <OInput
212
216
  value={spotNumber?.toString() ?? ''}
213
217
  placeholder={placeholderText}
214
- keyboardType='number-pad'
218
+ type='number-pad'
215
219
  onChange={(value: string) => setSpotNumber(value)}
216
220
  style={{
217
221
  borderColor: theme.colors.border,
@@ -76,8 +76,8 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
76
76
  },
77
77
  quantityContainer: {
78
78
  position: 'absolute',
79
- left: '100%',
80
- bottom: '100%',
79
+ right: 0,
80
+ top: 0,
81
81
  width: 25,
82
82
  height: 25,
83
83
  textAlign: 'center',
@@ -125,12 +125,12 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
125
125
  );
126
126
 
127
127
  const fadeIn = () => {
128
- Animated.timing(fadeAnim, {
129
- toValue: 1,
130
- duration: 500,
128
+ Animated.timing(fadeAnim, {
129
+ toValue: 1,
130
+ duration: 500,
131
131
  useNativeDriver: true
132
- }).start();
133
- };
132
+ }).start();
133
+ };
134
134
 
135
135
  const handleChangeFavorite = () => {
136
136
  if (auth) {
@@ -164,7 +164,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
164
164
  <View style={{ flexDirection: 'row' }}>
165
165
  {productAddedToCartLength > 0 && (
166
166
  <QuantityContainer style={[styles.quantityContainer, {
167
- transform: [{ translateX: 10 }, { translateY: -10 }],
167
+ transform: [{ translateX: 25 }, { translateY: -55 }],
168
168
  }]}>
169
169
  <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
170
170
  </QuantityContainer>
@@ -281,19 +281,24 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
281
281
  )}
282
282
  </CardContainer>
283
283
  ) : (
284
- <Placeholder style={{ padding: 5 }} Animation={Fade}>
285
- <View style={{ flexDirection: 'row' }}>
284
+ <View style={{ minHeight: 165, marginBottom: 28, padding: 12 }}>
285
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
286
+ <View style={{ flexDirection: 'row' }}>
287
+ <Placeholder style={{ paddingVertical: 10, flex: 1 }}>
288
+ <PlaceholderLine width={60} style={{ marginBottom: 15 }} />
289
+ <PlaceholderLine width={20} />
290
+ </Placeholder>
291
+ <PlaceholderLine
292
+ width={24}
293
+ height={70}
294
+ style={{ marginLeft: 10, marginBottom: 10 }}
295
+ />
296
+ </View>
286
297
  <PlaceholderLine
287
- width={24}
288
- height={70}
289
- style={{ marginRight: 10, marginBottom: 10 }}
298
+ height={52}
290
299
  />
291
- <Placeholder style={{ paddingVertical: 10 }}>
292
- <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
293
- <PlaceholderLine width={20} />
294
- </Placeholder>
295
- </View>
296
- </Placeholder>
300
+ </Placeholder>
301
+ </View>
297
302
  )}
298
303
  </InView>
299
304
  );