ordering-ui-react-native 0.16.49 → 0.16.52

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.
Files changed (25) hide show
  1. package/package.json +1 -1
  2. package/src/components/ReviewProducts/index.tsx +11 -0
  3. package/src/components/SingleProductReview/index.tsx +1 -1
  4. package/themes/original/index.tsx +6 -0
  5. package/themes/original/src/components/BusinessController/index.tsx +12 -4
  6. package/themes/original/src/components/BusinessProductsList/index.tsx +1 -0
  7. package/themes/original/src/components/BusinessProductsListing/index.tsx +4 -4
  8. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +36 -24
  9. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
  10. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +27 -24
  11. package/themes/original/src/components/BusinessesListing/index.tsx +99 -25
  12. package/themes/original/src/components/ProductForm/index.tsx +481 -481
  13. package/themes/original/src/components/ProductForm/styles.tsx +5 -1
  14. package/themes/original/src/components/Reviews/ReviewDriver/index.tsx +301 -0
  15. package/themes/original/src/components/Reviews/ReviewDriver/styles.tsx +39 -0
  16. package/themes/original/src/components/Reviews/ReviewOrder/index.tsx +326 -0
  17. package/themes/original/src/components/Reviews/ReviewOrder/styles.tsx +53 -0
  18. package/themes/original/src/components/Reviews/ReviewProducts/index.tsx +101 -0
  19. package/themes/original/src/components/Reviews/ReviewProducts/styles.tsx +17 -0
  20. package/themes/original/src/components/Reviews/index.tsx +9 -0
  21. package/themes/original/src/components/ServiceForm/index.tsx +15 -5
  22. package/themes/original/src/components/SignupForm/index.tsx +26 -24
  23. package/themes/original/src/components/SingleProductCard/index.tsx +3 -2
  24. package/themes/original/src/components/shared/OBottomPopup.tsx +26 -7
  25. package/themes/original/src/types/index.tsx +26 -20
@@ -0,0 +1,53 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const ReviewOrderContainer = styled.ScrollView`
4
+ padding: 20px 40px;
5
+ margin-bottom: 100px;
6
+ `
7
+
8
+ export const BusinessLogo = styled.View`
9
+ margin-vertical: 5px;
10
+ align-items: center;
11
+ `
12
+
13
+ export const FormReviews = styled.View`
14
+ flex: 1;
15
+ height: 100%;
16
+ margin-top: 30px;
17
+ `
18
+
19
+ export const CommentsButtonGroup = styled.View`
20
+ flex-direction: row;
21
+ flex-wrap: wrap;
22
+ `
23
+
24
+ export const ActionContainer = styled.View`
25
+ flex-direction: row;
26
+ align-items: center;
27
+ justify-content: space-between;
28
+ padding: 3px 30px;
29
+ `
30
+
31
+ export const SkipButton = styled.TouchableOpacity`
32
+ `
33
+
34
+ export const RatingBarContainer = styled.View`
35
+ margin-top: 10px;
36
+ margin-bottom: 25px;
37
+ `
38
+
39
+ export const RatingTextContainer = styled.View`
40
+ flex-direction: row;
41
+ align-items: center;
42
+ justify-content: space-between;
43
+ margin-top: 10px;
44
+ `
45
+ export const RatingStarContainer = styled.View`
46
+ flex-direction: row;
47
+ align-items: center;
48
+ justify-content: space-between;
49
+ margin-top: 10px;
50
+ `
51
+ export const PlacedDate = styled.View`
52
+ margin-top: 30px;
53
+ `
@@ -0,0 +1,101 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage, useToast, ToastType, ReviewProduct as ReviewProductController } from 'ordering-components/native'
3
+ import { OText, OButton } from '../../shared'
4
+ import { ReviewProductParams } from '../../../types'
5
+ import { FloatingBottomContainer } from '../../../layouts/FloatingBottomContainer'
6
+ import { useTheme } from 'styled-components/native'
7
+ import { SingleProductReview } from '../../SingleProductReview'
8
+
9
+ import {
10
+ ReviewProductsContainer,
11
+ ActionContainer,
12
+ SkipButton
13
+ } from './styles'
14
+
15
+ const ReviewProductsUI = (props: ReviewProductParams) => {
16
+ const {
17
+ navigation,
18
+ order,
19
+ formState,
20
+ handleChangeFormState,
21
+ handleSendProductReview,
22
+ closeReviewProduct
23
+ } = props
24
+
25
+ const [, t] = useLanguage()
26
+ const theme = useTheme()
27
+ const [, { showToast }] = useToast()
28
+
29
+ const [isProductReviewed, setIsProductReviewed] = useState(false)
30
+ const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
31
+
32
+ const handleContinueClick = () => {
33
+ setAlertState({ ...alertState, success: true })
34
+ handleSendProductReview()
35
+ }
36
+ useEffect(() => {
37
+ if (alertState.open) {
38
+ alertState.content && showToast(
39
+ ToastType.Error,
40
+ alertState.content
41
+ )
42
+ }
43
+ }, [alertState.content])
44
+
45
+ useEffect(() => {
46
+ if (!formState.loading && formState.result?.error) {
47
+ setAlertState({
48
+ open: true,
49
+ success: false,
50
+ content: formState.result?.result || [t('ERROR', 'Error')]
51
+ })
52
+ }
53
+ if (!formState.loading && !formState.result?.error && alertState.success) {
54
+ setIsProductReviewed && setIsProductReviewed(true)
55
+ closeReviewProduct && closeReviewProduct()
56
+ }
57
+ }, [formState])
58
+
59
+ return (
60
+ <>
61
+ <ReviewProductsContainer>
62
+ {order?.products?.map((product: any) => (
63
+ <SingleProductReview
64
+ key={product.id}
65
+ product={product}
66
+ formState={formState}
67
+ handleChangeFormState={handleChangeFormState}
68
+ />
69
+ ))}
70
+ </ReviewProductsContainer>
71
+
72
+ <FloatingBottomContainer>
73
+ <ActionContainer>
74
+ <SkipButton
75
+ onPress={() => closeReviewProduct && closeReviewProduct()}
76
+ >
77
+ <OText weight={700} size={18} color={theme.colors.textNormal}>{t('FRONT_VISUALS_SKIP', 'Skip')}</OText>
78
+ </SkipButton>
79
+ <OButton
80
+ textStyle={{ color: theme.colors.white, paddingRight: 10 }}
81
+ text={order?.driver && !order?.user_review ? t('CONTINUE', 'Continue') : t('SEND_REVIEW', 'Send Review')}
82
+ style={{ borderRadius: 8 }}
83
+ imgRightSrc={theme.images.general.arrow_right}
84
+ imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
85
+ isDisabled={formState.loading || formState?.changes?.length === 0}
86
+ onClick={() => handleContinueClick()}
87
+ />
88
+ </ActionContainer>
89
+ </FloatingBottomContainer>
90
+ </>
91
+ )
92
+ }
93
+
94
+ export const ReviewProducts = (props: any) => {
95
+ const reviewProductProps = {
96
+ ...props,
97
+ UIComponent: ReviewProductsUI,
98
+ isToast: true
99
+ }
100
+ return <ReviewProductController {...reviewProductProps} />
101
+ }
@@ -0,0 +1,17 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const ReviewProductsContainer = styled.ScrollView`
4
+ padding: 20px 40px;
5
+ margin-bottom: 100px;
6
+ max-height: 400px;
7
+ `
8
+
9
+ export const ActionContainer = styled.View`
10
+ flex-direction: row;
11
+ align-items: center;
12
+ justify-content: space-between;
13
+ padding: 3px 30px;
14
+ `
15
+
16
+ export const SkipButton = styled.TouchableOpacity`
17
+ `
@@ -0,0 +1,9 @@
1
+ import { ReviewOrder as ReviewOrderModal } from './ReviewOrder';
2
+ import { ReviewProducts as ReviewProductsModal } from './ReviewProducts';
3
+ import { ReviewDriver as ReviewDriverModal } from './ReviewDriver';
4
+
5
+ export {
6
+ ReviewOrderModal,
7
+ ReviewProductsModal,
8
+ ReviewDriverModal
9
+ }
@@ -65,8 +65,8 @@ const ServiceFormUI = (props: ServiceFormParams) => {
65
65
 
66
66
  const styles = StyleSheet.create({
67
67
  photoStyle: {
68
- width: 42,
69
- height: 42,
68
+ width: 45,
69
+ height: 45,
70
70
  borderRadius: 7.6
71
71
  },
72
72
  buttonStyle: {
@@ -313,12 +313,14 @@ const ServiceFormUI = (props: ServiceFormParams) => {
313
313
  <OText
314
314
  size={14}
315
315
  weight={'400'}
316
+ lineHeight={22}
316
317
  >
317
318
  {currentProfessional?.name} {currentProfessional?.lastname}
318
319
  </OText>
319
320
  <OText
320
321
  size={12}
321
322
  weight={'400'}
323
+ lineHeight={17}
322
324
  color={isBusyTime(currentProfessional) ? theme.colors.danger5 : theme.colors.success500}
323
325
  >
324
326
  {isBusyTime(currentProfessional)
@@ -459,9 +461,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
459
461
  size={14}
460
462
  weight={Platform.OS === 'ios' ? '600' : 'bold'}
461
463
  >
462
- {dateSelected
463
- ? moment(dateSelected).format('hh:mm A')
464
- : t('ASAP_ABBREVIATION', 'ASAP')}
464
+ {dateSelected && moment(dateSelected).format('hh:mm A')}
465
465
  </OText>
466
466
  {((productCart &&
467
467
  auth &&
@@ -517,6 +517,14 @@ const ServiceFormUI = (props: ServiceFormParams) => {
517
517
  entireModal
518
518
  >
519
519
  <ScrollView contentContainerStyle={styles.professionalList}>
520
+ <View style={{ padding: 11 }}>
521
+ <OText
522
+ size={14}
523
+ weight={'400'}
524
+ >
525
+ {t('ANY_OROFESSIONAL_MEMBER', 'Any professional member')}
526
+ </OText>
527
+ </View>
520
528
  {professionalList?.map((professional: any) => professional?.products?.includes(product?.id) && (
521
529
  <TouchableOpacity
522
530
  key={professional?.id}
@@ -536,12 +544,14 @@ const ServiceFormUI = (props: ServiceFormParams) => {
536
544
  <OText
537
545
  size={14}
538
546
  weight={'400'}
547
+ lineHeight={22}
539
548
  >
540
549
  {professional?.name} {professional?.lastname}
541
550
  </OText>
542
551
  <OText
543
552
  size={12}
544
553
  weight={'400'}
554
+ lineHeight={17}
545
555
  color={isBusyTime(professional) ? theme.colors.danger5 : theme.colors.success500}
546
556
  >
547
557
  {isBusyTime(professional)
@@ -443,36 +443,38 @@ const SignupFormUI = (props: SignupParams) => {
443
443
  titleStyle={{ marginLeft: 0, marginRight: 0 }}
444
444
  />
445
445
  <FormSide>
446
- {(useSignUpFullDetails) && (
446
+ {((Number(useSignUpFullDetails) + Number(useSignUpOtpEmail) + Number(useSignUpOtpCellphone)) > 1) && (
447
447
  <SignupWith>
448
448
  <OTabs
449
449
  horizontal
450
450
  showsHorizontalScrollIndicator={false}
451
451
  ref={tabsRef}
452
452
  >
453
- <TabBtn
454
- onPress={() => handleSignUpTab('default')}
455
- onLayout={(event: any) => handleOnLayout(event, 'default')}
456
- >
457
- <OTab
458
- style={{
459
- borderBottomColor:
460
- signUpTab === 'default'
461
- ? theme.colors.textNormal
462
- : theme.colors.border,
463
- }}>
464
- <OText
465
- size={14}
466
- color={
467
- signUpTab === 'default'
468
- ? theme.colors.textNormal
469
- : theme.colors.disabled
470
- }
471
- weight={signUpTab === 'default' ? 'bold' : 'normal'}>
472
- {t('DEFAULT', 'Default')}
473
- </OText>
474
- </OTab>
475
- </TabBtn>
453
+ {useSignUpFullDetails && (
454
+ <TabBtn
455
+ onPress={() => handleSignUpTab('default')}
456
+ onLayout={(event: any) => handleOnLayout(event, 'default')}
457
+ >
458
+ <OTab
459
+ style={{
460
+ borderBottomColor:
461
+ signUpTab === 'default'
462
+ ? theme.colors.textNormal
463
+ : theme.colors.border,
464
+ }}>
465
+ <OText
466
+ size={14}
467
+ color={
468
+ signUpTab === 'default'
469
+ ? theme.colors.textNormal
470
+ : theme.colors.disabled
471
+ }
472
+ weight={signUpTab === 'default' ? 'bold' : 'normal'}>
473
+ {t('DEFAULT', 'Default')}
474
+ </OText>
475
+ </OTab>
476
+ </TabBtn>
477
+ )}
476
478
  {useSignUpOtpEmail && (
477
479
  <TabBtn
478
480
  onPress={() => handleSignUpTab('otpEmail')}
@@ -31,7 +31,8 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
31
31
  onProductClick,
32
32
  productAddedToCartLength,
33
33
  style,
34
- handleFavoriteProduct
34
+ handleFavoriteProduct,
35
+ enableIntersection
35
36
  } = props;
36
37
 
37
38
  const theme = useTheme();
@@ -89,7 +90,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
89
90
  const [stateConfig] = useConfig();
90
91
  const [{ parsePrice, optimizeImage }] = useUtils();
91
92
  const [orderState] = useOrder();
92
- const [isIntersectionObserver, setIsIntersectionObserver] = useState(false)
93
+ const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
93
94
  const editMode = typeof product?.code !== 'undefined';
94
95
 
95
96
  const removeToBalance = editMode ? product?.quantity : 0;
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
- import { Modal, TouchableWithoutFeedback, Dimensions, StyleSheet, View, Text, Platform, StatusBar } from 'react-native'
2
+ import { Modal, TouchableWithoutFeedback, TouchableOpacity, Dimensions, StyleSheet, View, Text, Platform, StatusBar } from 'react-native'
3
3
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
4
+ import { OIcon } from '.';
4
5
  const deviceHeight = Dimensions.get('window').height
5
6
 
6
7
  interface Props {
@@ -9,6 +10,9 @@ interface Props {
9
10
  children?: any;
10
11
  onClose?: any;
11
12
  isStatusBar?: boolean;
13
+ bottomContainerStyle?: any;
14
+ titleStyle?: any;
15
+ closeIcon?: any;
12
16
  }
13
17
  const OBottomPopup = (props: Props) => {
14
18
  const {
@@ -16,7 +20,10 @@ const OBottomPopup = (props: Props) => {
16
20
  title,
17
21
  onClose,
18
22
  children,
19
- isStatusBar
23
+ isStatusBar,
24
+ titleStyle,
25
+ bottomContainerStyle,
26
+ closeIcon
20
27
  } = props
21
28
  const { top, bottom } = useSafeAreaInsets();
22
29
  return (
@@ -27,7 +34,7 @@ const OBottomPopup = (props: Props) => {
27
34
  onRequestClose={() => onClose()}
28
35
  presentationStyle={'fullScreen'}
29
36
  >
30
- {isStatusBar && <StatusBar translucent={false} />}
37
+ {isStatusBar && <StatusBar translucent={false} />}
31
38
  <View style={styles.container}>
32
39
  <TouchableWithoutFeedback
33
40
  style={styles.touchableOutsideStyle}
@@ -35,10 +42,18 @@ const OBottomPopup = (props: Props) => {
35
42
  >
36
43
  <View style={styles.touchableOutsideStyle} />
37
44
  </TouchableWithoutFeedback>
38
- <View style={styles.bottomContainer}>
45
+ <View style={{ ...styles.bottomContainer, ...bottomContainerStyle }}>
39
46
  <View style={{ paddingTop: top, paddingBottom: bottom }}>
40
- {title != '' && (
41
- <Text style={styles.titleStyle}>
47
+ {closeIcon && (
48
+ <TouchableOpacity onPress={onClose} style={styles.closeIconStyle}>
49
+ <OIcon
50
+ src={closeIcon}
51
+ width={30}
52
+ />
53
+ </TouchableOpacity>
54
+ )}
55
+ {!!title && (
56
+ <Text style={{ ...styles.titleStyle, ...titleStyle }}>
42
57
  {title}
43
58
  </Text>
44
59
  )}
@@ -69,7 +84,11 @@ const styles = StyleSheet.create({
69
84
  titleStyle: {
70
85
  fontSize: 20,
71
86
  fontWeight: 'bold',
72
- marginVertical: 15
87
+ marginVertical: 10
88
+ },
89
+ closeIconStyle: {
90
+ paddingTop: 20,
91
+ paddingLeft: 20
73
92
  }
74
93
  })
75
94
 
@@ -213,6 +213,7 @@ export interface BusinessControllerParams {
213
213
  handleFavoriteBusiness?: any,
214
214
  setFavoriteIds?: any;
215
215
  handleUpdateBusinessList?: any;
216
+ enableIntersection?: boolean;
216
217
  }
217
218
  export interface BusinessProductsListingParams {
218
219
  navigation?: any;
@@ -289,15 +290,16 @@ export interface BusinessProductsListParams {
289
290
  handleUpdateProducts?: any
290
291
  }
291
292
  export interface SingleProductCardParams {
292
- businessId: any,
293
+ businessId: any;
293
294
  product: any;
294
295
  isSoldOut: boolean;
295
296
  onProductClick: any;
296
297
  productAddedToCartLength: number;
297
- style?: ViewStyle,
298
- categoryState?: any,
299
- handleFavoriteProduct?: any,
300
- handleUpdateProducts?: any
298
+ style?: ViewStyle;
299
+ categoryState?: any;
300
+ handleFavoriteProduct?: any;
301
+ handleUpdateProducts?: any;
302
+ enableIntersection?: boolean;
301
303
  }
302
304
  export interface BusinessInformationParams {
303
305
  navigation?: any,
@@ -415,25 +417,28 @@ export interface ProductItemAccordionParams {
415
417
  isFromCheckout?: any
416
418
  }
417
419
  export interface ReviewOrderParams {
418
- order?: { id: number, businessId: number, business_name?: string, delivery_datetime?: string, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
419
- stars?: any,
420
- handleChangeInput?: any,
421
- handleChangeRating?: any,
422
- handleSendReview?: any,
423
- formState?: any,
424
- navigation?: any,
425
- setIsReviewed?: (isReviewed: boolean) => {},
426
- handleReviewState?: any,
427
- setStars?: any,
428
- onNavigationRedirect?: any
420
+ order?: { id: number, business_id: number, business_name?: string, delivery_datetime?: string, logo: string, driver: any, products: Array<any>, review: any, user_review: any };
421
+ stars?: any;
422
+ handleChangeInput?: any;
423
+ handleChangeRating?: any;
424
+ handleSendReview?: any;
425
+ formState?: any;
426
+ navigation?: any;
427
+ setIsReviewed?: (isReviewed: boolean) => void;
428
+ handleReviewState?: any;
429
+ setStars?: any;
430
+ onNavigationRedirect?: any;
431
+ closeReviewOrder?: () => void;
432
+ skipReview?: () => void;
429
433
  }
430
434
  export interface ReviewProductParams {
431
435
  navigation?: any,
432
436
  onNavigationRedirect?: any,
433
- order?: { orderId: number, businessId: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
437
+ order?: { orderId: number, business_id: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
434
438
  formState?: any,
435
439
  handleChangeFormState?: any,
436
- handleSendProductReview?: any
440
+ handleSendProductReview?: any;
441
+ closeReviewProduct?: () => void;
437
442
  }
438
443
  export interface SingleProductReviewParams {
439
444
  product: any,
@@ -443,12 +448,13 @@ export interface SingleProductReviewParams {
443
448
  export interface ReviewDriverParams {
444
449
  navigation?: any,
445
450
  onNavigationRedirect?: any,
446
- order?: { orderId: number, businessId: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
451
+ order?: { orderId: number, business_id: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
447
452
  formState?: any,
448
453
  setIsDriverReviewed?: (isReviewed: boolean) => {},
449
454
  dirverReviews?: any,
450
455
  setDriverReviews?: any,
451
- handleSendDriverReview?: any
456
+ handleSendDriverReview?: any;
457
+ closeReviewDriver?: () => void;
452
458
  }
453
459
  export interface MessagesParams {
454
460
  type?: string,