ordering-ui-react-native 0.16.73 → 0.16.75

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.73",
3
+ "version": "0.16.75",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -93,7 +93,7 @@ const CheckoutUI = (props: any) => {
93
93
  deliveryOptionSelected,
94
94
  instructionsOptions,
95
95
  handleChangeDeliveryOption,
96
-
96
+ merchantId
97
97
  } = props
98
98
 
99
99
  const theme = useTheme();
@@ -530,6 +530,7 @@ const CheckoutUI = (props: any) => {
530
530
  handlePaymentMethodClickCustom={handlePaymentMethodClick}
531
531
  setCardData={setCardData}
532
532
  handlePlaceOrder={handlePlaceOrder}
533
+ merchantId={merchantId}
533
534
  />
534
535
  </ChPaymethods>
535
536
  </ChSection>
@@ -62,7 +62,8 @@ const PaymentOptionsUI = (props: any) => {
62
62
  handlePaymentMethodClickCustom,
63
63
  isOpenMethod,
64
64
  setCardData,
65
- handlePlaceOrder
65
+ handlePlaceOrder,
66
+ merchantId
66
67
  } = props
67
68
 
68
69
  const theme = useTheme();
@@ -220,7 +221,7 @@ const PaymentOptionsUI = (props: any) => {
220
221
 
221
222
  {paymethodSelected?.gateway === 'cash' && (
222
223
  <PaymentOptionCash
223
- orderTotal={cart.total}
224
+ orderTotal={cart.balance ?? cart.total}
224
225
  defaultValue={paymethodSelected?.data?.cash}
225
226
  onChangeData={handlePaymethodDataChange}
226
227
  setErrorCash={props.setErrorCash}
@@ -322,6 +323,7 @@ const PaymentOptionsUI = (props: any) => {
322
323
  publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
323
324
  handleSource={handlePaymethodDataChange}
324
325
  onCancel={() => handlePaymethodClick(null)}
326
+ merchantId={merchantId}
325
327
  />
326
328
  </KeyboardAvoidingView>
327
329
  </OModal>
@@ -7,7 +7,6 @@ import {
7
7
  useConfirmSetupIntent,
8
8
  createPaymentMethod
9
9
  } from '@stripe/stripe-react-native';
10
- import configs from '../../config.json'
11
10
  import { ErrorMessage } from './styles';
12
11
 
13
12
  import { StripeElementsForm as StripeFormController } from './naked';
@@ -26,7 +25,8 @@ const StripeElementsFormUI = (props: any) => {
26
25
  methodsPay,
27
26
  paymethod,
28
27
  onCancel,
29
- cart
28
+ cart,
29
+ merchantId
30
30
  } = props;
31
31
 
32
32
  const theme = useTheme();
@@ -54,17 +54,25 @@ const StripeElementsFormUI = (props: any) => {
54
54
  }
55
55
 
56
56
  if (user?.address) {
57
- billingDetails.addressLine1 = user?.address
58
- }
57
+ billingDetails.address = {
58
+ line1: user?.address
59
+ }
60
+ }
59
61
 
60
62
  const createPayMethod = async () => {
61
- const params: any = { type: 'Card' }
62
- if (Object.keys(billingDetails).length > 0) {
63
- params.billingDetails = billingDetails
64
- }
63
+ const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
64
+ if (Object.keys(billingDetails).length > 0) {
65
+ params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
66
+ }
65
67
  try {
66
68
  setCreatePmLoading(true)
67
- const { paymentMethod } = await createPaymentMethod(params);
69
+ const { paymentMethod, error } = await createPaymentMethod(params);
70
+
71
+ if (error) {
72
+ setErrors(error?.message);
73
+ setCreatePmLoading(false)
74
+ return
75
+ }
68
76
 
69
77
  setCreatePmLoading(false)
70
78
  handleSource && handleSource({
@@ -87,10 +95,10 @@ const StripeElementsFormUI = (props: any) => {
87
95
  createPayMethod();
88
96
  return
89
97
  }
90
- const params: any = { type: 'Card' }
91
- if (Object.keys(billingDetails).length > 0) {
92
- params.billingDetails = billingDetails
93
- }
98
+ const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
99
+ if (Object.keys(billingDetails).length > 0) {
100
+ params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
101
+ }
94
102
  try {
95
103
  const { setupIntent, error } = await confirmSetupIntent(requirements, params);
96
104
 
@@ -126,12 +134,13 @@ const StripeElementsFormUI = (props: any) => {
126
134
  <View style={styles.container}>
127
135
  {publicKey ? (
128
136
  <View style={{ flex: 1 }}>
129
- <StripeProvider
137
+ <StripeProvider
130
138
  publishableKey={publicKey}
131
- merchantIdentifier={`merchant.${configs.apple_app_id}`}
139
+ merchantIdentifier={`merchant.${merchantId}`}
140
+ urlScheme={merchantId}
132
141
  >
133
142
  {methodsPay?.includes(paymethod) ? (
134
- <StripeMethodForm
143
+ <StripeMethodForm
135
144
  handleSource={handleSource}
136
145
  onCancel={onCancel}
137
146
  cart={cart}
@@ -372,7 +372,7 @@ export const OrderContentComponent = (props: OrderContent) => {
372
372
  <Table>
373
373
  <OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
374
374
  <OText mBottom={4}>
375
- {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
375
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency})}
376
376
  </OText>
377
377
  </Table>
378
378
  {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
@@ -385,7 +385,7 @@ export const OrderContentComponent = (props: OrderContent) => {
385
385
  ) : (
386
386
  <OText mBottom={4}>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
387
387
  )}
388
- <OText>- {parsePrice(order?.summary?.discount ?? order?.discount)}</OText>
388
+ <OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency})}</OText>
389
389
  </Table>
390
390
  )}
391
391
  {
@@ -399,7 +399,7 @@ export const OrderContentComponent = (props: OrderContent) => {
399
399
  )}
400
400
  </OText>
401
401
  </OSRow>
402
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
402
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
403
403
  </Table>
404
404
  ))
405
405
  }
@@ -407,9 +407,9 @@ export const OrderContentComponent = (props: OrderContent) => {
407
407
  <Table>
408
408
  <OText mBottom={4}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
409
409
  {order?.tax_type === 1 ? (
410
- <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
410
+ <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency})}</OText>
411
411
  ) : (
412
- <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
412
+ <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency})}</OText>
413
413
  )}
414
414
  </Table>
415
415
  )}
@@ -419,7 +419,7 @@ export const OrderContentComponent = (props: OrderContent) => {
419
419
  {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
420
420
  </OText>
421
421
  <OText mBottom={4}>
422
- {parsePrice(order?.summary?.tax ?? 0)}
422
+ {parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency})}
423
423
  </OText>
424
424
  </Table>
425
425
  )}
@@ -430,7 +430,7 @@ export const OrderContentComponent = (props: OrderContent) => {
430
430
  {t('SERVICE_FEE', 'Service fee')}
431
431
  {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
432
432
  </OText>
433
- <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0)}</OText>
433
+ <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency})}</OText>
434
434
  </Table>
435
435
  )
436
436
  }
@@ -443,7 +443,7 @@ export const OrderContentComponent = (props: OrderContent) => {
443
443
  {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
444
444
  </OText>
445
445
  </OSRow>
446
- <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
446
+ <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency})}</OText>
447
447
  </Table>
448
448
  ))
449
449
  }
@@ -453,10 +453,10 @@ export const OrderContentComponent = (props: OrderContent) => {
453
453
  <OSRow>
454
454
  <OText mBottom={4}>
455
455
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
456
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
456
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency})} + `}{fee.percentage}%){' '}
457
457
  </OText>
458
458
  </OSRow>
459
- <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
459
+ <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency})}</OText>
460
460
  </Table>
461
461
  ))
462
462
  }
@@ -471,7 +471,7 @@ export const OrderContentComponent = (props: OrderContent) => {
471
471
  )}
472
472
  </OText>
473
473
  </OSRow>
474
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
474
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
475
475
  </Table>
476
476
  ))
477
477
  }
@@ -483,7 +483,7 @@ export const OrderContentComponent = (props: OrderContent) => {
483
483
  </OText>
484
484
 
485
485
  <OText mBottom={4}>
486
- {parsePrice(order?.summary?.delivery_price)}
486
+ {parsePrice(order?.summary?.delivery_price, { currency: order?.currency})}
487
487
  </OText>
488
488
  </Table>
489
489
  )
@@ -499,7 +499,7 @@ export const OrderContentComponent = (props: OrderContent) => {
499
499
  )}
500
500
  </OText>
501
501
  </OSRow>
502
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
502
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
503
503
  </Table>
504
504
  ))
505
505
  }
@@ -514,7 +514,7 @@ export const OrderContentComponent = (props: OrderContent) => {
514
514
  `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
515
515
  )}
516
516
  </OText>
517
- <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
517
+ <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency})}</OText>
518
518
  </Table>
519
519
  )}
520
520
 
@@ -528,7 +528,7 @@ export const OrderContentComponent = (props: OrderContent) => {
528
528
  mBottom={4}
529
529
  style={styles.textBold}
530
530
  color={theme.colors.primary}>
531
- {parsePrice(order?.summary?.total ?? order?.total)}
531
+ {parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency})}
532
532
  </OText>
533
533
  </Table>
534
534
  </Total>
@@ -571,7 +571,7 @@ export const OrderContentComponent = (props: OrderContent) => {
571
571
  )}
572
572
  </View>
573
573
  <OText>
574
- -{parsePrice(event.amount)}
574
+ -{parsePrice(event.amount, { currency: order?.currency})}
575
575
  </OText>
576
576
  </View>
577
577
  ))}
@@ -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,19 +464,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
464
464
  />
465
465
  </OrderTypesContainer>
466
466
  )}
467
- {!businessId && (
468
- <View style={{ marginTop: 20 }}>
469
- <OButton
470
- onClick={() => navigation.navigate('BusinessSearch', { businessTypes })}
471
- text={t('SEARCH', 'Search')}
472
- style={styles?.buttonCityStyle}
473
- textStyle={{ color: theme.colors.textSecondary, fontSize: 16 }}
474
- />
475
- </View>
476
- )}
477
467
 
478
468
  {!hideCities && (
479
- <View style={{ marginTop: 10 }}>
469
+ <View style={{ marginTop: 20 }}>
480
470
  <TouchableOpacity
481
471
  style={styles.buttonCityStyle}
482
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>
@@ -160,7 +160,6 @@ const PaymentOptionsUI = (props: any) => {
160
160
  <TouchableOpacity
161
161
  onPress={() => handlePaymentMethodClick(item)}
162
162
  >
163
- {console.log(item?.gateway)}
164
163
  <PMItem
165
164
  key={item.id}
166
165
  isDisabled={isDisabled}
@@ -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
  );
@@ -61,7 +61,9 @@ const StripeElementsFormUI = (props: any) => {
61
61
  }
62
62
 
63
63
  if (user?.address) {
64
- billingDetails.address.line1 = user?.address
64
+ billingDetails.address = {
65
+ line1: user?.address
66
+ }
65
67
  }
66
68
 
67
69
  const createPayMethod = async () => {
@@ -71,7 +73,13 @@ const StripeElementsFormUI = (props: any) => {
71
73
  }
72
74
  try {
73
75
  setCreatePmLoading(true)
74
- const { paymentMethod } = await createPaymentMethod(params);
76
+ const { paymentMethod, error } = await createPaymentMethod(params);
77
+
78
+ if (error) {
79
+ setErrors(error?.message);
80
+ setCreatePmLoading(false)
81
+ return
82
+ }
75
83
 
76
84
  setCreatePmLoading(false)
77
85
  handleSource && handleSource({