ordering-ui-react-native 0.15.20 → 0.15.21

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.15.20",
3
+ "version": "0.15.21",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -87,6 +87,7 @@ const CouponControlUI = (props: any) => {
87
87
  ) : (
88
88
  <CCWrapper>
89
89
  <OInput
90
+ value={couponInput}
90
91
  placeholder={t('DISCOUNT_COUPON', 'Discount coupon')}
91
92
  onChange={(e: any) => onChangeInputCoupon(e)}
92
93
  style={styles.inputsStyle}
@@ -5,7 +5,7 @@ import {
5
5
  useLanguage,
6
6
  OrderDetails as OrderDetailsConTableoller,
7
7
  useUtils,
8
- useConfig,
8
+ useConfig
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
11
  import {
@@ -28,6 +28,7 @@ import {
28
28
  OrderDriver,
29
29
  Map,
30
30
  Divider,
31
+ OrderAction
31
32
  } from './styles';
32
33
  import { OButton, OIcon, OModal, OText } from '../shared';
33
34
  import { ProductItemAccordion } from '../ProductItemAccordion';
@@ -48,6 +49,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
48
49
  readMessages,
49
50
  isFromCheckout,
50
51
  driverLocation,
52
+ onNavigationRedirect,
53
+ reorderState,
54
+ handleReorder
51
55
  } = props;
52
56
 
53
57
  const theme = useTheme();
@@ -83,11 +87,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
83
87
  const [, t] = useLanguage();
84
88
  const [{ parsePrice, parseNumber, parseDate }] = useUtils();
85
89
  const [{ configs }] = useConfig();
86
-
87
90
  const [isReviewed, setIsReviewed] = useState(false)
88
91
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
89
92
 
90
- const { order } = props.order;
93
+ const { order, businessData } = props.order;
91
94
 
92
95
  const walletName: any = {
93
96
  cash: {
@@ -310,8 +313,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
310
313
  business: type === 'business',
311
314
  driver: type === 'driver',
312
315
  onClose: () => navigation?.canGoBack()
313
- ? navigation.goBack()
314
- : navigation.navigate('BottomTab', { screen: 'MyOrders' }),
316
+ ? navigation.goBack()
317
+ : navigation.navigate('BottomTab', { screen: 'MyOrders' }),
315
318
  }
316
319
  )
317
320
  }
@@ -356,6 +359,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
356
359
  )
357
360
  }
358
361
 
362
+
363
+ useEffect(() => {
364
+ if (reorderState?.error) {
365
+ navigation.navigate('Business', { store: businessData?.slug })
366
+ }
367
+ if (!reorderState?.error && reorderState?.result?.uuid) {
368
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
369
+ }
370
+ }, [reorderState])
371
+
359
372
  useEffect(() => {
360
373
  BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
361
374
  return () => {
@@ -737,16 +750,37 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
737
750
  'Once business accepts your order, we will send you an email, thank you!',
738
751
  )}
739
752
  </OText>
740
- <OButton
741
- text={t('YOUR_ORDERS', 'Your Orders')}
742
- textStyle={{ fontSize: 14, color: theme.colors.primary }}
743
- imgRightSrc={null}
744
- borderColor={theme.colors.primary}
745
- bgColor={theme.colors.clear}
746
- style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
747
- parentStyle={{ marginTop: 29, width: '50%' }}
748
- onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
749
- />
753
+ <OrderAction>
754
+ <OButton
755
+ text={t('YOUR_ORDERS', 'Your Orders')}
756
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
757
+ imgRightSrc={null}
758
+ borderColor={theme.colors.primary}
759
+ bgColor={theme.colors.clear}
760
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
761
+ parentStyle={{ marginTop: 29, marginEnd: 15 }}
762
+ onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
763
+ />
764
+ {(
765
+ parseInt(order?.status) === 1 ||
766
+ parseInt(order?.status) === 2 ||
767
+ parseInt(order?.status) === 5 ||
768
+ parseInt(order?.status) === 6 ||
769
+ parseInt(order?.status) === 10 ||
770
+ parseInt(order?.status) === 11 ||
771
+ parseInt(order?.status) === 12
772
+ ) && (
773
+ <OButton
774
+ text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
775
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
776
+ imgRightSrc={null}
777
+ borderColor='transparent'
778
+ bgColor={theme.colors.primary + 10}
779
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
780
+ onClick={() => handleReorder && handleReorder(order.id)}
781
+ />
782
+ )}
783
+ </OrderAction>
750
784
  </HeaderInfo>
751
785
  <OrderProducts>
752
786
  {order?.products?.length &&
@@ -125,3 +125,6 @@ export const Divider = styled.View`
125
125
  margin-top: 5px;
126
126
  margin-bottom: 5px;
127
127
  `
128
+ export const OrderAction = styled.View`
129
+ flex-direction: row;
130
+ `
@@ -143,9 +143,9 @@ export interface BusinessesListingParams {
143
143
  export interface HighestRatedBusinessesParams {
144
144
  businessesList: { businesses: Array<any>, loading: boolean, error: null | string };
145
145
  onBusinessClick?: void;
146
- navigation? :any;
146
+ navigation?: any;
147
147
  isLoading?: boolean;
148
- getBusinesses: (newFetch : boolean) => void
148
+ getBusinesses: (newFetch: boolean) => void
149
149
  }
150
150
  export interface BusinessTypeFilterParams {
151
151
  businessTypes?: Array<any>;
@@ -182,7 +182,7 @@ export interface BusinessProductsListingParams {
182
182
  header?: any;
183
183
  logo?: any;
184
184
  productModal?: any;
185
- getNextProducts?: () => {};
185
+ getNextProducts?: () => {};
186
186
  handleChangeCategory: (value: any) => {};
187
187
  setProductLogin?: () => {};
188
188
  updateProductModal?: (value: any) => {};
@@ -209,8 +209,8 @@ export interface BusinessProductsCategoriesParams {
209
209
  categoriesLayout?: any;
210
210
  selectedCategoryId?: any;
211
211
  lazyLoadProductsRecommended?: any;
212
- setSelectedCategoryId?: any
213
- setCategoryClicked?: any
212
+ setSelectedCategoryId?: any
213
+ setCategoryClicked?: any
214
214
  }
215
215
  export interface BusinessProductsListParams {
216
216
  errors?: any;
@@ -321,7 +321,10 @@ export interface OrderDetailsParams {
321
321
  isFromCheckout?: boolean,
322
322
  driverLocation?: any,
323
323
  isFromRoot?: any,
324
- goToBusinessList?: boolean
324
+ goToBusinessList?: boolean,
325
+ onNavigationRedirect?: any,
326
+ reorderState?: any,
327
+ handleReorder?: any,
325
328
  }
326
329
  export interface ProductItemAccordionParams {
327
330
  key?: any;
@@ -355,7 +358,7 @@ export interface ReviewProductParams {
355
358
  formState?: any,
356
359
  handleChangeFormState?: any,
357
360
  handleSendProductReview?: any
358
- }
361
+ }
359
362
  export interface SingleProductReviewParams {
360
363
  product: any,
361
364
  formState?: any,
@@ -522,34 +525,34 @@ export interface HelpGuideParams {
522
525
  export interface HelpAccountAndPaymentParams {
523
526
  navigation: any;
524
527
  }
525
-
528
+
526
529
  export interface MessageListingParams {
527
530
  navigation: any;
528
531
  franchiseId?: any;
529
532
  }
530
533
 
531
- export interface BusinessSearchParams {
534
+ export interface BusinessSearchParams {
532
535
  navigation: any,
533
- businessesSearchList: any,
534
- onBusinessClick: any,
535
- handleChangeTermValue: (term: string) => void,
536
- termValue: string,
537
- paginationProps: any,
538
- handleSearchbusinessAndProducts: (newFetch?: boolean) => void,
539
- handleChangeFilters: (prop : string, value : any) => void,
540
- filters: any,
541
- businessTypes: Array<number>,
542
- setFilters: (filters: any) => void,
536
+ businessesSearchList: any,
537
+ onBusinessClick: any,
538
+ handleChangeTermValue: (term: string) => void,
539
+ termValue: string,
540
+ paginationProps: any,
541
+ handleSearchbusinessAndProducts: (newFetch?: boolean) => void,
542
+ handleChangeFilters: (prop: string, value: any) => void,
543
+ filters: any,
544
+ businessTypes: Array<number>,
545
+ setFilters: (filters: any) => void,
543
546
  lazySearch?: boolean
544
547
  }
545
-
548
+
546
549
  export interface NoNetworkParams {
547
550
  image?: any,
548
551
  }
549
552
 
550
553
  export interface PlaceSpotParams {
551
554
  isOpenPlaceSpot?: boolean,
552
- cart?: any ,
555
+ cart?: any,
553
556
  placesState?: any,
554
557
  handleChangePlace?: any,
555
558
  getPlacesList?: any,