ordering-ui-react-native 0.21.77 → 0.21.78

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.21.77",
3
+ "version": "0.21.78",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -237,7 +237,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
237
237
  {products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
238
238
  <SingleProductCard
239
239
  key={`${product?.id}_${i}`}
240
- enableIntersection={!isFiltMode}
240
+ // enableIntersection={!isFiltMode}
241
241
  isSoldOut={product.inventoried && !product.quantity}
242
242
  businessId={businessId}
243
243
  product={product}
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react'
2
- import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView, Keyboard, KeyboardEvent, BackHandler } from 'react-native'
2
+ import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView, Keyboard, KeyboardEvent, BackHandler, ScrollView } from 'react-native'
3
3
  import { IOScrollView } from 'react-native-intersection-observer'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native';
@@ -534,7 +534,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
534
534
  </View>
535
535
  </FiltProductsContainer>
536
536
  )}
537
- <IOScrollView
537
+ <ScrollView
538
538
  stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
539
539
  style={{
540
540
  ...styles.mainContainer,
@@ -662,7 +662,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
662
662
  {isOpenFiltProducts && (
663
663
  <BackgroundGray isIos={Platform.OS === 'ios'} />
664
664
  )}
665
- </IOScrollView>
665
+ </ScrollView>
666
666
  {viewOrderButtonVisible && (
667
667
  <View style={{ marginBottom: 0 }}>
668
668
  <FloatingButton
@@ -219,7 +219,7 @@ const CartUI = (props: any) => {
219
219
 
220
220
  return (
221
221
  <CContainer>
222
- {openUpselling && (
222
+ {!!openUpselling && (
223
223
  <UpsellingProducts
224
224
  handleUpsellingPage={handleUpsellingPage}
225
225
  openUpselling={openUpselling}
@@ -859,7 +859,7 @@ const CheckoutUI = (props: any) => {
859
859
  {!cartState.loading && cart && (
860
860
  <ChSection>
861
861
  <ChCart>
862
- {cartsWithProducts && cart?.products?.length === 0 ? (
862
+ {cartsWithProducts?.length > 0 && cart?.products?.length === 0 ? (
863
863
  <NotFoundSource
864
864
  content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
865
865
  btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
@@ -937,13 +937,15 @@ const CheckoutUI = (props: any) => {
937
937
  </OText>
938
938
  )}
939
939
 
940
- {!cart?.valid_products && cart?.status !== 2 && (
941
- <OText
942
- color={theme.colors.error}
943
- size={12}
944
- >
945
- {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
946
- </OText>
940
+ {!cart?.valid_products && cart?.status !== 2 && cart?.total !== 0 && (
941
+ <>
942
+ <OText
943
+ color={theme.colors.error}
944
+ size={12}
945
+ >
946
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
947
+ </OText>
948
+ </>
947
949
  )}
948
950
  {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
949
951
  <OText
@@ -10,7 +10,7 @@ import {
10
10
  ToastType,
11
11
  MultiCheckout as MultiCheckoutController
12
12
  } from 'ordering-components/native'
13
- import { View, StyleSheet, Platform, ScrollView } from 'react-native'
13
+ import { View, StyleSheet, Platform, ScrollView, SafeAreaView } from 'react-native'
14
14
  import { useTheme } from 'styled-components/native';
15
15
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
16
16
  import { Container } from '../../layouts/Container';
@@ -285,30 +285,32 @@ const MultiCheckoutUI = (props: any) => {
285
285
 
286
286
  return (
287
287
  <>
288
- <View style={styles.wrapperNavbar}>
289
- <TopHeader>
290
- <>
291
- <TopActions onPress={() => navigation?.canGoBack() && navigation.goBack()}>
292
- <IconAntDesign
293
- name='arrowleft'
294
- size={26}
295
- />
296
- </TopActions>
297
- {showTitle && (
298
- <OText
299
- size={16}
300
- style={{ flex: 1, textAlign: 'center', right: 15 }}
301
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
302
- numberOfLines={2}
303
- ellipsizeMode='tail'
304
- >
305
- {t('CHECKOUT', 'Checkout')}
306
- </OText>
307
- )}
308
- </>
309
- </TopHeader>
310
- </View>
311
- <Container noPadding onScroll={handleScroll}>
288
+ <SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
289
+ <View style={styles.wrapperNavbar}>
290
+ <TopHeader>
291
+ <>
292
+ <TopActions onPress={() => navigation?.canGoBack() && navigation.goBack()}>
293
+ <IconAntDesign
294
+ name='arrowleft'
295
+ size={26}
296
+ />
297
+ </TopActions>
298
+ {showTitle && (
299
+ <OText
300
+ size={16}
301
+ style={{ flex: 1, textAlign: 'center', right: 15 }}
302
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
303
+ numberOfLines={2}
304
+ ellipsizeMode='tail'
305
+ >
306
+ {t('CHECKOUT', 'Checkout')}
307
+ </OText>
308
+ )}
309
+ </>
310
+ </TopHeader>
311
+ </View>
312
+ </SafeAreaView>
313
+ <Container pt={0} noPadding onScroll={handleScroll}>
312
314
  <View style={styles.wrapperNavbar}>
313
315
  <NavBar
314
316
  hideArrowLeft
@@ -53,6 +53,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
53
53
  const [{ configs }] = useConfig()
54
54
 
55
55
  const isTaxIncludedOnPrice = orders.every((_order: any) => _order.taxes?.length ? _order.taxes?.every((_tax: any) => _tax.type === 1) : true)
56
+ const deliveryType = orders.find((order: any) => order.delivery_type)?.delivery_type
56
57
  const progressBarStyle = configs.multi_business_checkout_progress_bar_style?.value
57
58
  const showBarInOrder = ['group', 'both']
58
59
  const showBarInIndividual = ['individual', 'both']
@@ -171,19 +172,23 @@ export const MultiOrdersDetailsUI = (props: any) => {
171
172
  ))}
172
173
  </Section>
173
174
  <Divider />
174
- <Section>
175
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
176
- {t('DELIVERYA_V21', 'Delivery address')}
177
- </OText>
178
- {loading ? (
179
- <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
180
- ) : (
181
- <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
182
- {customer?.address}
183
- </OText>
184
- )}
185
- </Section>
186
- <Divider />
175
+ {deliveryType === 1 && (
176
+ <>
177
+ <Section>
178
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
179
+ {t('DELIVERYA_V21', 'Delivery address')}
180
+ </OText>
181
+ {loading ? (
182
+ <PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
183
+ ) : (
184
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
185
+ {customer?.address}
186
+ </OText>
187
+ )}
188
+ </Section>
189
+ <Divider />
190
+ </>
191
+ )}
187
192
  {loading ? (
188
193
  <Placeholder Animation={Fade}>
189
194
  <PlaceholderLine
@@ -364,6 +364,7 @@ const PaymentOptionsUI = (props: any) => {
364
364
  methodPaySupported={methodPaySupported}
365
365
  placeByMethodPay={placeByMethodPay}
366
366
  setPlaceByMethodPay={setPlaceByMethodPay}
367
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
367
368
  />
368
369
  )}
369
370
 
@@ -406,6 +407,7 @@ const PaymentOptionsUI = (props: any) => {
406
407
  handleSource={handlePaymethodDataChange}
407
408
  onCancel={() => handlePaymethodClick(null)}
408
409
  merchantId={merchantId}
410
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
409
411
  />
410
412
  </KeyboardAvoidingView>
411
413
  </OModal>
@@ -425,11 +427,12 @@ const PaymentOptionsUI = (props: any) => {
425
427
  <StripeCardsList
426
428
  paymethod={isOpenMethod?.paymethod}
427
429
  businessId={props.businessId}
428
- publicKey={isOpenMethod?.paymethod?.credentials.publishable}
429
430
  payType={paymethodsList?.name}
430
431
  onSelectCard={handlePaymethodDataChange}
431
432
  onNavigationRedirect={onNavigationRedirect}
432
433
  onCancel={() => handlePaymethodClick(null)}
434
+ publicKey={isOpenMethod?.paymethod?.credentials.publishable}
435
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
433
436
  />
434
437
  </View>
435
438
  )}
@@ -446,6 +449,7 @@ const PaymentOptionsUI = (props: any) => {
446
449
  enabled={Platform.OS === 'ios' ? true : false}
447
450
  >
448
451
  <StripeElementsForm
452
+ openCarts={props.openCarts}
449
453
  toSave
450
454
  businessId={props.businessId}
451
455
  publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
@@ -453,6 +457,35 @@ const PaymentOptionsUI = (props: any) => {
453
457
  accountId={isOpenMethod?.paymethod?.credentials?.user}
454
458
  onSelectCard={handlePaymethodDataChange}
455
459
  onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
460
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
461
+ />
462
+ </KeyboardAvoidingView>
463
+ </OModal>
464
+
465
+ {/* Stripe Add card */}
466
+ <OModal
467
+ entireModal
468
+ title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
469
+ open={addCardOpen?.stripe}
470
+ onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
471
+ style={{ backgroundColor: 'red' }}
472
+ >
473
+ <KeyboardAvoidingView
474
+ behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
475
+ keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
476
+ enabled={Platform.OS === 'ios' ? true : false}
477
+ >
478
+ <StripeElementsForm
479
+ openCarts={props.openCarts}
480
+ toSave
481
+ businessId={props.businessId}
482
+ businessIds={props.businessIds}
483
+ publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
484
+ setCardsList={setCardList}
485
+ requirements={props.clientSecret}
486
+ onSelectCard={handlePaymethodDataChange}
487
+ onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
488
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
456
489
  />
457
490
  </KeyboardAvoidingView>
458
491
  </OModal>
@@ -62,8 +62,6 @@ import { IOScrollView } from 'react-native-intersection-observer';
62
62
 
63
63
  const windowWidth = Dimensions.get('window').width;
64
64
 
65
-
66
-
67
65
  export const ProductOptionsUI = (props: any) => {
68
66
  const {
69
67
  navigation,
@@ -441,7 +439,7 @@ export const ProductOptionsUI = (props: any) => {
441
439
  selOpt
442
440
  }
443
441
 
444
- const suboptionsLength = product.extras.reduce((acc : number, extras : any) => acc + extras?.options?.reduce((accSuboptions : number, options: any) => accSuboptions + options?.suboptions?.length, 0), 0)
442
+ const suboptionsLength = product?.extras?.reduce((acc : number, extras : any) => acc + extras?.options?.reduce((accSuboptions : number, options: any) => accSuboptions + options?.suboptions?.length, 0), 0)
445
443
 
446
444
  return (
447
445
  <SafeAreaView style={{ flex: 1 }}>
@@ -169,7 +169,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
169
169
  }
170
170
 
171
171
  return (
172
- <InView style={{ minHeight: hideAddButton ? 125 : 190, marginLeft: logoPosition === 'left' ? 12.5 : 0 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
172
+ <View style={{ minHeight: hideAddButton ? 125 : 190, marginLeft: logoPosition === 'left' ? 12.5 : 0 }}>
173
173
  {isIntersectionObserver ? (
174
174
  <CardAnimation
175
175
  onClick={() => handleClickproduct()}
@@ -340,7 +340,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
340
340
  </Placeholder>
341
341
  </View>
342
342
  )}
343
- </InView>
343
+ </View>
344
344
  );
345
345
  }, SingleProductCardPropsAreEqual);
346
346
 
@@ -30,12 +30,7 @@ export const StripeCardsListUI = (props: any) => {
30
30
  cardsList,
31
31
  handleCardClick,
32
32
  onOpen,
33
- onCancel,
34
33
  gateway,
35
- setCardsList,
36
- addCardOpen,
37
- isOpenMethod,
38
- handlePaymethodDataChange
39
34
  } = props;
40
35
 
41
36
  const theme = useTheme();
@@ -148,33 +143,6 @@ export const StripeCardsListUI = (props: any) => {
148
143
  ))}
149
144
  </ScrollView>
150
145
  )}
151
- <OModal
152
- entireModal
153
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
154
- open={addCardOpen?.stripe}
155
- onClose={onCancel}
156
- style={{ backgroundColor: 'red' }}
157
- >
158
- <KeyboardAvoidingView
159
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
160
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
161
- enabled={Platform.OS === 'ios' ? true : false}
162
- >
163
- <StripeElementsForm
164
- openCarts={props.openCarts}
165
- toSave
166
- businessId={props.businessId}
167
- businessIds={props.businessIds}
168
- publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
169
- setCardsList={setCardsList}
170
- cardsList={cardsList}
171
- requirements={props.clientSecret}
172
- handleCardClick={handleCardClick}
173
- onSelectCard={handlePaymethodDataChange}
174
- onCancel={onCancel}
175
- />
176
- </KeyboardAvoidingView>
177
- </OModal>
178
146
  </>
179
147
  )
180
148
  }
@@ -33,7 +33,8 @@ const StripeElementsFormUI = (props: any) => {
33
33
  placeByMethodPay,
34
34
  methodPaySupported,
35
35
  setPlaceByMethodPay,
36
- cartTotal
36
+ cartTotal,
37
+ publicKeyAddCard
37
38
  } = props;
38
39
 
39
40
  const theme = useTheme();
@@ -52,6 +53,7 @@ const StripeElementsFormUI = (props: any) => {
52
53
  const [isKeyboardShow, setIsKeyboardShow] = useState(false);
53
54
  const zipCodeEnabled = validationFields?.fields?.card?.zipcode?.enabled
54
55
  const zipCodeRequired = validationFields?.fields?.card?.zipcode?.required
56
+ const isToSave = methodsPay?.includes(paymethod) ? publicKey : publicKeyAddCard
55
57
  const styles = StyleSheet.create({
56
58
  container: {
57
59
  width: '100%',
@@ -200,7 +202,7 @@ const StripeElementsFormUI = (props: any) => {
200
202
  {publicKey ? (
201
203
  <View style={{ flex: 1 }}>
202
204
  <StripeProvider
203
- publishableKey={publicKey}
205
+ publishableKey={isToSave}
204
206
  merchantIdentifier={merchantId}
205
207
  urlScheme={merchantId}
206
208
  >