ordering-ui-react-native 0.16.62 → 0.16.63

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.62",
3
+ "version": "0.16.63",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -111,6 +111,13 @@ const ChatUI = (props: MessagesParams) => {
111
111
  { key: 'driver_message_4', text: t('DRIVER_MESSAGE_4', 'driver_message_4') }
112
112
  ]
113
113
 
114
+ const adminMessageList: any = [
115
+ { key: 'message_1', text: t('ADMIN_MESSAGE_1', 'admin_message_1') },
116
+ { key: 'message_2', text: t('ADMIN_MESSAGE_2', 'admin_message_2') },
117
+ { key: 'message_3', text: t('ADMIN_MESSAGE_3', 'admin_message_3') },
118
+ { key: 'message_4', text: t('ADMIN_MESSAGE_4', 'admin_message_4') }
119
+ ]
120
+
114
121
  const handleClickQuickMessage = (text: string) => {
115
122
  setMessage && setMessage(`${message}${text}`)
116
123
  }
@@ -426,7 +433,8 @@ const ChatUI = (props: MessagesParams) => {
426
433
  };
427
434
 
428
435
  useEffect(() => {
429
- if (user.level === 2) setMessageList(storeMessageList)
436
+ if (user.level === 0) setMessageList(adminMessageList)
437
+ else if (user.level === 2) setMessageList(storeMessageList)
430
438
  else if (user.level === 4) setMessageList(driverMessageList)
431
439
  else setMessageList([])
432
440
  }, [user])
@@ -88,7 +88,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
88
88
  handleClickLogisticOrder,
89
89
  logisticOrders,
90
90
  loadLogisticOrders,
91
- isLogisticActivated
91
+ isLogisticActivated,
92
+ isAlsea
92
93
  } = props;
93
94
 
94
95
  const defaultSearchList = {
@@ -545,7 +546,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
545
546
  </ScrollView>
546
547
  </FiltersTab>
547
548
  <View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
548
- {currentTabSelected !== 'logisticOrders' && (
549
+ {currentTabSelected !== 'logisticOrders' && !isAlsea && (
549
550
  <View
550
551
  style={{
551
552
  display: 'flex',
@@ -293,7 +293,8 @@ export interface OrdersOptionParams {
293
293
  handleClickLogisticOrder: (status: number, orderId: number) => void,
294
294
  logisticOrders: {orders: Array<any>, loading: boolean, error: Array<string> | string},
295
295
  loadLogisticOrders: () => void;
296
- isLogisticActivated?: boolean
296
+ isLogisticActivated?: boolean;
297
+ isAlsea?: boolean;
297
298
  }
298
299
  export interface ActiveOrdersParams {
299
300
  orders?: any;
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { StyleSheet, View, TouchableOpacity, Linking } from 'react-native';
2
+ import { StyleSheet, View, TouchableOpacity, Linking, Pressable } from 'react-native';
3
3
  import { useUtils, useOrder, useLanguage, useOrderingTheme } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { OIcon, OText, OModal } from '../shared';
@@ -218,14 +218,14 @@ export const BusinessBasicInformation = (
218
218
  />
219
219
  )}
220
220
  {!!business?.tiktok_profile && (
221
- <TouchableOpacity style={styles.socialIcon} onPress={() => Linking.openURL(business?.tiktok_profile)}>
221
+ <Pressable style={styles.socialIcon} onPress={() => Linking.openURL(business?.tiktok_profile)}>
222
222
  <View style={styles.tiktokIcon}>
223
223
  <OIcon
224
224
  src={theme.images.general.tiktok}
225
225
  style={{ width: '100%', height: '100%' }}
226
226
  />
227
227
  </View>
228
- </TouchableOpacity>
228
+ </Pressable>
229
229
  )}
230
230
  {!!business?.pinterest_profile && (
231
231
  <SocialNetWork
@@ -327,7 +327,7 @@ export const BusinessBasicInformation = (
327
327
  </Placeholder>
328
328
  ) : (
329
329
  <TitleWrapper>
330
- <OText size={24} weight={'600'}>
330
+ <OText size={24} weight={'600'} numberOfLines={2}>
331
331
  {business?.name}
332
332
  </OText>
333
333
  {business?.ribbon?.enabled && (
@@ -216,6 +216,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
216
216
  }
217
217
  }
218
218
 
219
+ const handleChangeCity = (cityId : number | null) => {
220
+ changeCityFilter(orderState?.options?.city_id === cityId ? null : cityId)
221
+ setIsOpenCities(false)
222
+ }
223
+
219
224
  useEffect(() => {
220
225
  if (!businessesList?.loading) {
221
226
  const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
@@ -345,11 +350,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
345
350
  <OText size={18} weight={700} color={theme.colors?.white}>
346
351
  {t('WELCOME', 'Welcome')} {user?.name}!
347
352
  </OText>
348
- <TouchableOpacity
349
- onPress={() => searchBarRef?.current?.focus?.()}
350
- >
351
- <Ionicons name='search' style={{ ...styles.iconStyle, color: theme.colors?.white }} />
352
- </TouchableOpacity>
353
353
  </View>
354
354
  )}
355
355
  <Search isChewLayout={isChewLayout}>
@@ -654,7 +654,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
654
654
  borderBottomColor: orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.backgroundGray,
655
655
  marginBottom: 10,
656
656
  }}
657
- onPress={() => changeCityFilter(city?.id)}
657
+ onPress={() => handleChangeCity(city?.id)}
658
658
  disabled={orderState?.loading}
659
659
  >
660
660
  <OText color={orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.black}>
@@ -60,11 +60,11 @@ const CartUI = (props: any) => {
60
60
 
61
61
  const isCartPending = cart?.status === 2
62
62
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
63
- const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
63
+ const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
64
64
 
65
65
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
66
66
  const businessId = business?.business_id ?? null
67
- const placeSpotTypes = [3, 4]
67
+ const placeSpotTypes = [4]
68
68
 
69
69
  const momentFormatted = !orderState?.option?.moment
70
70
  ? t('RIGHT_NOW', 'Right Now')
@@ -99,10 +99,10 @@ const CartUI = (props: any) => {
99
99
  setOpenUpselling(false)
100
100
  setCanOpenUpselling(false)
101
101
  if (isCheckoutMultiBusinessEnabled) {
102
- props.onNavigationRedirect('CheckoutNavigator', {
103
- screen: 'MultiCheckout'
104
- })
105
- } else {
102
+ props.onNavigationRedirect('CheckoutNavigator', {
103
+ screen: 'MultiCheckout'
104
+ })
105
+ } else {
106
106
  props.onNavigationRedirect('CheckoutNavigator', {
107
107
  screen: 'CheckoutPage',
108
108
  cartUuid: cart?.uuid,
@@ -446,7 +446,7 @@ const CartUI = (props: any) => {
446
446
  </OText>
447
447
  </View>
448
448
  )}
449
- </>
449
+ </>
450
450
  )}
451
451
  </BusinessItemAccordion>
452
452
 
@@ -169,7 +169,7 @@ export const ProductOptionsUI = (props: any) => {
169
169
  const [gallery, setGallery] = useState([])
170
170
  const [thumbsSwiper, setThumbsSwiper] = useState(0)
171
171
  const [indexGallery, setIndexGallery] = useState(0)
172
- const [selOpt, setSelectedOpt] = useState(0);
172
+ const [selOpt, setSelectedOpt] = useState(-1);
173
173
  const [isHaveWeight, setIsHaveWeight] = useState(false)
174
174
  const [playing, setPlaying] = useState(false);
175
175
  const [qtyBy, setQtyBy] = useState({
@@ -323,6 +323,14 @@ export const ProductOptionsUI = (props: any) => {
323
323
  </>
324
324
  );
325
325
 
326
+ const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
327
+
328
+ const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
329
+ if (_topOption) {
330
+ const _topOptionId = Number(_topOption.replace('id:', ''))
331
+ }
332
+ }
333
+
326
334
  const handleGoBack = navigation?.canGoBack()
327
335
  ? () => navigation.goBack()
328
336
  : () => navigation.navigate('Business', { store: props.businessSlug })
@@ -408,7 +416,7 @@ export const ProductOptionsUI = (props: any) => {
408
416
  height: 44,
409
417
  shadowOpacity: 0,
410
418
  borderWidth: 1,
411
- marginTop: isHaveWeight ? 10: 0
419
+ marginTop: isHaveWeight ? 10 : 0
412
420
  }}
413
421
  />
414
422
  )}
@@ -457,7 +465,8 @@ export const ProductOptionsUI = (props: any) => {
457
465
  <ScrollView
458
466
  ref={scrollViewRef}
459
467
  contentContainerStyle={{ paddingBottom: 80 }}
460
- stickyHeaderIndices={[2]}>
468
+ stickyHeaderIndices={[2]}
469
+ onScroll={handleScroll}>
461
470
  <WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
462
471
  {loading && !product ? (
463
472
  <View style={styles.productHeaderSkeleton}>
@@ -681,36 +690,36 @@ export const ProductOptionsUI = (props: any) => {
681
690
  contentContainerStyle={{ paddingHorizontal: 33, backgroundColor: theme.colors.white }}
682
691
  >
683
692
  <TouchableOpacity
684
- key={`eopt_all_0`}
685
- onPress={() => setSelectedOpt(0)}
693
+ key={`eopt_key_00`}
694
+ onPress={() => setSelectedOpt(-1)}
686
695
  style={[
687
696
  styles.extraItem,
688
697
  {
689
- borderBottomColor: selOpt == 0 ? theme.colors.textNormal : theme.colors.border,
698
+ borderBottomColor: selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
690
699
  },
691
700
  ]}>
692
701
  <OText
693
- color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
694
- size={selOpt == 0 ? 14 : 12}
695
- weight={selOpt == 0 ? '600' : 'normal'}>
702
+ color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
703
+ size={selOpt == -1 ? 14 : 12}
704
+ weight={selOpt == -1 ? '600' : 'normal'}>
696
705
  {t('ALL', 'All')}
697
706
  </OText>
698
707
  </TouchableOpacity>
699
708
  {product?.ingredients.length > 0 && (
700
709
  <TouchableOpacity
701
- key={`eopt_all_00`}
702
- onPress={() => setSelectedOpt(-1)}
710
+ key={`eopt_key_01`}
711
+ onPress={() => setSelectedOpt(0)}
703
712
  style={[
704
713
  styles.extraItem,
705
714
  {
706
715
  borderBottomColor:
707
- selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
716
+ selOpt == 0 ? theme.colors.textNormal : theme.colors.border,
708
717
  },
709
718
  ]}>
710
719
  <OText
711
- color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
712
- size={selOpt == -1 ? 14 : 12}
713
- weight={selOpt == -1 ? '600' : 'normal'}>
720
+ color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
721
+ size={selOpt == 0 ? 14 : 12}
722
+ weight={selOpt == 0 ? '600' : 'normal'}>
714
723
  {t('INGREDIENTS', 'Ingredients')}
715
724
  </OText>
716
725
  </TouchableOpacity>
@@ -760,10 +769,10 @@ export const ProductOptionsUI = (props: any) => {
760
769
  </>
761
770
  ) : (
762
771
  <ProductEditions>
763
- {selOpt == 0 ? (
772
+ {selOpt === -1 ? (
764
773
  <>
765
774
  {product?.ingredients.length > 0 && (
766
- <View style={styles.optionContainer}>
775
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
767
776
  <SectionTitle>
768
777
  <OText size={16}>
769
778
  {t('INGREDIENTS', 'Ingredients')}
@@ -845,7 +854,7 @@ export const ProductOptionsUI = (props: any) => {
845
854
  </>
846
855
  ) : (
847
856
  <>
848
- {selOpt == -1 ? (
857
+ {selOpt === 0 ? (
849
858
  <View style={styles.optionContainer}>
850
859
  <SectionTitle>
851
860
  <OText size={16}>