ordering-ui-react-native 0.13.6 → 0.14.0

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.13.6",
3
+ "version": "0.14.0",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -75,7 +75,7 @@
75
75
  "react-native-document-picker": "^5.2.0",
76
76
  "react-native-elements": "^3.0.0-alpha.1",
77
77
  "react-native-fast-image": "^8.3.3",
78
- "react-native-fbsdk": "^3.0.0",
78
+ "react-native-fbsdk-next": "^7.0.1",
79
79
  "react-native-geocoding": "^0.5.0",
80
80
  "react-native-gesture-handler": "^1.8.0",
81
81
  "react-native-gifted-chat": "^0.16.3",
@@ -21,6 +21,7 @@ import { ThemeProvider } from './context/Theme';
21
21
  import settings from './config.json';
22
22
  import theme from './theme.json';
23
23
  import AppContainer from './AppContainer';
24
+ import { FacebookPixel } from './components/FacebookPixel';
24
25
 
25
26
  Sentry.init({
26
27
  environment: Platform.OS === 'ios' ? 'ios' : 'android',
@@ -169,6 +170,7 @@ const DeliveryApp = () => {
169
170
  return (
170
171
  <ThemeProvider theme={theme}>
171
172
  <OrderingProvider settings={settings} Alert={Alert}>
173
+ <FacebookPixel />
172
174
  <AppContainer />
173
175
  <Toast />
174
176
  <Analytics />
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { StyleSheet, Text } from 'react-native';
3
- import { AccessToken, LoginManager } from 'react-native-fbsdk';
3
+ import { AccessToken, LoginManager } from 'react-native-fbsdk-next';
4
4
  import { useLanguage, useSession, useApi } from 'ordering-components/native';
5
5
 
6
6
  import Icon from 'react-native-vector-icons/FontAwesome5';
@@ -49,7 +49,7 @@ export const FacebookLogin = (props: any) => {
49
49
  handleErrors && handleErrors(response.content.result)
50
50
  logoutWithFacebook()
51
51
  }
52
- } catch (err) {
52
+ } catch (err : any) {
53
53
  handleLoading && handleLoading(false)
54
54
  handleErrors && handleErrors(err.message)
55
55
  }
@@ -0,0 +1,81 @@
1
+ import React, { useEffect } from 'react';
2
+ import { useEvent, useConfig } from 'ordering-components/native'
3
+ import { AppEventsLogger } from "react-native-fbsdk-next"
4
+
5
+ export const FacebookPixel = (props : any) => {
6
+ const {
7
+ children
8
+ } = props
9
+
10
+ const [configs] = useConfig()
11
+ const [events] = useEvent()
12
+
13
+ const handleLoginUser = () => {
14
+ AppEventsLogger.logEvent(AppEventsLogger.AppEvents.CompletedRegistration, {
15
+ [AppEventsLogger.AppEventParams.RegistrationMethod]: "login",
16
+ ["currency"]: "email"
17
+ })
18
+ }
19
+
20
+ const handleProductAdded = (product : any) => {
21
+ AppEventsLogger.logEvent(AppEventsLogger.AppEvents.AddedToCart, product?.total ?? product?.price , {
22
+ [AppEventsLogger.AppEventParams.Description]: product?.name,
23
+ [AppEventsLogger.AppEventParams.Currency]: configs?.stripe_currency?.value ?? 'USD',
24
+ [AppEventsLogger.AppEventParams.ContentID]: product?.id,
25
+ [AppEventsLogger.AppEventParams.ContentType]: "product",
26
+ ["fb_quantity"]: product?.quantity,
27
+ })
28
+ }
29
+
30
+ const handleProductEdited = (product : any) => {
31
+ AppEventsLogger.logEvent(AppEventsLogger.AppEvents.CustomizeProduct, product?.total ?? product?.price , {
32
+ [AppEventsLogger.AppEventParams.Description]: product?.name,
33
+ [AppEventsLogger.AppEventParams.Currency]: configs?.stripe_currency?.value ?? 'USD',
34
+ [AppEventsLogger.AppEventParams.ContentID]: product?.id,
35
+ [AppEventsLogger.AppEventParams.ContentType]: "product",
36
+ ["fb_quantity"]: product?.quantity,
37
+ })
38
+ }
39
+
40
+ const handleSignupUser = () => {
41
+ AppEventsLogger.logEvent(AppEventsLogger.AppEvents.CompletedRegistration, {
42
+ [AppEventsLogger.AppEventParams.RegistrationMethod]: "signup",
43
+ ["currency"]: "email"
44
+ })
45
+ }
46
+
47
+ const handlePaymentInfo = (payment : any) => {
48
+ AppEventsLogger.logEvent(AppEventsLogger.AppEvents.AddedPaymentInfo, {
49
+ [AppEventsLogger.AppEventParams.ContentType]: payment?.gateway,
50
+ [AppEventsLogger.AppEventParams.ContentID]: payment?.id
51
+ })
52
+ }
53
+
54
+ const handleOrderPlaced = (order : any) => {
55
+ AppEventsLogger.logPurchase(order.total, configs?.stripe_currency?.value ?? 'USD', { param: "value", id: order.id });
56
+ }
57
+
58
+ useEffect(() => {
59
+ events.on('userLogin', handleLoginUser)
60
+ events.on('product_added', handleProductAdded)
61
+ events.on('product_edited', handleProductEdited)
62
+ events.on('order_placed', handleOrderPlaced)
63
+ events.on('singup_user', handleSignupUser)
64
+ events.on('add_payment_option', handlePaymentInfo)
65
+
66
+ return () => {
67
+ events.off('userLogin', handleLoginUser)
68
+ events.off('product_added', handleProductAdded)
69
+ events.off('product_edited', handleProductEdited)
70
+ events.off('order_placed', handleOrderPlaced)
71
+ events.off('singup_user', handleSignupUser)
72
+ events.off('add_payment_option', handlePaymentInfo)
73
+ }
74
+ }, [])
75
+
76
+ return (
77
+ <>
78
+ {children}
79
+ </>
80
+ )
81
+ };
@@ -374,13 +374,13 @@ const LoginFormUI = (props: LoginParams) => {
374
374
  <SocialButtons>
375
375
  {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
376
376
  configs?.facebook_id?.value && (
377
- <FacebookLogin
378
- notificationState={notificationState}
379
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
380
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
381
- handleSuccessFacebookLogin={handleSuccessFacebook}
382
- />
383
- )}
377
+ <FacebookLogin
378
+ notificationState={notificationState}
379
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
380
+ handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
381
+ handleSuccessFacebookLogin={handleSuccessFacebook}
382
+ />
383
+ )}
384
384
  {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
385
385
  <GoogleLogin
386
386
  notificationState={notificationState}
package/src/index.tsx CHANGED
@@ -20,6 +20,7 @@ import { Checkout } from './components/Checkout';
20
20
  import { CouponControl } from './components/CouponControl';
21
21
  import { DriverTips } from './components/DriverTips';
22
22
  import { FacebookLogin } from './components/FacebookLogin';
23
+ import { FacebookPixel } from './components/FacebookPixel';
23
24
  import { FloatingButton } from './components/FloatingButton';
24
25
  import { ForgotPasswordForm } from './components/ForgotPasswordForm';
25
26
  import { GoogleMap } from './components/GoogleMap';
@@ -118,6 +119,7 @@ export {
118
119
  CouponControl,
119
120
  DriverTips,
120
121
  FacebookLogin,
122
+ FacebookPixel,
121
123
  FloatingButton,
122
124
  ForgotPasswordForm,
123
125
  GoogleMap,
@@ -0,0 +1 @@
1
+ declare module 'react-native-fbsdk-next';
@@ -71,7 +71,7 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
71
71
  <BusinessContainer>
72
72
  <BusinessHeader
73
73
  style={{...styles.businesInfoheaderStyle}}
74
- source={{ uri: header || optimizeImage(businessState?.business?.header, 'h_400,c_limit') }}
74
+ source={{ uri: header || optimizeImage(businessState?.business?.header, 'h_300,c_limit') }}
75
75
  >
76
76
  <BusinessLogo>
77
77
  {loading ? (
@@ -83,7 +83,7 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
83
83
  ) : (
84
84
  !isBusinessInfoShow && (
85
85
  <OIcon
86
- url={logo || optimizeImage(businessState?.business?.logo, 'h_300,c_limit')}
86
+ url={logo || optimizeImage(businessState?.business?.logo, 'h_100,c_limit')}
87
87
  style={styles.businessLogo}
88
88
  cover
89
89
  />
@@ -140,13 +140,15 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
140
140
  <OText color={theme.colors.textSecondary} numberOfLines={1} style={{ flexBasis: '85%', marginEnd: 6 }}>
141
141
  {orderState?.options?.address?.address}
142
142
  </OText>
143
- <TouchableOpacity
144
- onPress={() => auth
145
- ? onRedirect('AddressList', { isGoBack: true, isFromProductsList: true })
146
- : onRedirect('AddressForm', { address: orderState.options?.address })}
147
- >
148
- <OIcon width={16} src={theme.images.general.pencil} />
149
- </TouchableOpacity>
143
+ {!isBusinessInfoShow && (
144
+ <TouchableOpacity
145
+ onPress={() => auth
146
+ ? onRedirect('AddressList', { isGoBack: true, isFromProductsList: true })
147
+ : onRedirect('AddressForm', { address: orderState.options?.address })}
148
+ >
149
+ <OIcon width={16} src={theme.images.general.pencil} />
150
+ </TouchableOpacity>
151
+ )}
150
152
  </View>
151
153
  <View style={{ ...styles.infoItem, paddingStart: 12 }}>
152
154
  <OText color={theme.colors.textSecondary} numberOfLines={1} style={{ flexBasis: '85%', paddingEnd: 6 }}>
@@ -154,46 +156,16 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
154
156
  ? moment(orderState.options?.moment).format('dddd, MMM.DD.yyyy hh:mm A')
155
157
  : t('ASAP_ABBREVIATION', 'ASAP')}
156
158
  </OText>
157
- <TouchableOpacity
158
- onPress={() => navigation.navigate('MomentOption')}
159
- >
160
- <OIcon src={theme.images.general.info} width={16} />
161
- </TouchableOpacity>
159
+ {!isBusinessInfoShow && (
160
+ <TouchableOpacity
161
+ onPress={() => navigation.navigate('MomentOption')}
162
+ >
163
+ <OIcon src={theme.images.general.info} width={16} />
164
+ </TouchableOpacity>
165
+ )}
162
166
  </View>
163
167
  </>
164
- }
165
- {/* <View style={styles.bullet}>
166
- <IconEvilIcons
167
- name='clock'
168
- color={theme.colors.textSecondary}
169
- size={16}
170
- />
171
- {orderState?.options?.type === 1 ? (
172
- <OText color={theme.colors.textSecondary} style={styles.metadata}>
173
- {convertHoursToMinutes(business?.delivery_time)}
174
- </OText>
175
- ) : (
176
- <OText color={theme.colors.textSecondary} style={styles.metadata}>
177
- {convertHoursToMinutes(business?.pickup_time)}
178
- </OText>
179
- )}
180
- </View>
181
- <View style={styles.bullet}>
182
- <IconEvilIcons
183
- name='location'
184
- color={theme.colors.textSecondary}
185
- size={16}
186
- />
187
- <OText color={theme.colors.textSecondary} style={styles.metadata}>{parseDistance(business?.distance || 0)}</OText>
188
- </View>
189
- <View style={styles.bullet}>
190
- <MaterialComIcon
191
- name='truck-delivery'
192
- color={theme.colors.textSecondary}
193
- size={16}
194
- />
195
- </View>
196
- <OText color={theme.colors.textSecondary} style={styles.metadata}>{business && parsePrice(business?.delivery_price || 0)}</OText> */}
168
+ }
197
169
  </BusinessInfoItem>
198
170
  </View>
199
171
  {showReview && (
@@ -144,7 +144,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
144
144
 
145
145
  <BusinessLogo>
146
146
  <OIcon
147
- url={optimizeImage(business?.logo, 'h_300,c_limit')}
147
+ url={optimizeImage(business?.logo, 'h_50,c_limit')}
148
148
  style={styles.businessLogo}
149
149
  />
150
150
  </BusinessLogo>
@@ -11,7 +11,6 @@ export const GrayBackground = styled.View`
11
11
  `
12
12
  export const WrapMainContent = styled.ScrollView`
13
13
  flex: 1;
14
- margin-top: 40px;
15
14
  `
16
15
  export const InnerContent = styled.View`
17
16
  padding: 30px 20px;
@@ -4,14 +4,15 @@ import { SingleProductCard } from '../SingleProductCard'
4
4
  import { NotFoundSource } from '../NotFoundSource'
5
5
  import { BusinessProductsListParams } from '../../types'
6
6
  import { OText } from '../shared'
7
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
8
+ import { Platform, View, TouchableOpacity } from 'react-native'
9
+ import { useTheme } from 'styled-components/native'
7
10
  import {
8
11
  ProductsContainer,
9
12
  ErrorMessage,
10
- WrapperNotFound
13
+ WrapperNotFound,
14
+ ProductsWrapper
11
15
  } from './styles'
12
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
13
- import { Platform, View, TouchableOpacity } from 'react-native'
14
- import { useTheme } from 'styled-components/native'
15
16
  import { ScrollView } from 'react-native-gesture-handler'
16
17
 
17
18
  const BusinessProductsListUI = (props: BusinessProductsListParams) => {
@@ -42,8 +43,11 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
42
43
  if (categoryState?.products.length > allProducts.length) {
43
44
  setAllProducts(categoryState?.products.sort((a: any, b: any) => a.id - b.id))
44
45
  }
46
+ if (searchValue) {
47
+ setAllProducts(categoryState?.products.sort((a: any, b: any) => a.id - b.id))
48
+ }
45
49
  }
46
- }, [category, categoryState])
50
+ }, [category, categoryState, searchValue])
47
51
 
48
52
  return (
49
53
  <ProductsContainer>
@@ -67,7 +71,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
67
71
  >
68
72
  <OText style={{...theme.labels.subtitle, fontWeight: Platform.OS == 'ios' ? '600' : 'bold'}} mBottom={10}>{t('FEATURED', 'Featured')}</OText>
69
73
  </TouchableOpacity>
70
- <ScrollView horizontal showsHorizontalScrollIndicator={false}>
74
+ <ProductsWrapper>
71
75
  {allProducts?.map((product: any, index: number) => product.featured && (
72
76
  <SingleProductCard
73
77
  key={index}
@@ -77,7 +81,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
77
81
  onProductClick={onProductClick}
78
82
  />
79
83
  ))}
80
- </ScrollView>
84
+ </ProductsWrapper>
81
85
  </>
82
86
  )
83
87
  }
@@ -95,7 +99,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
95
99
  >
96
100
  <OText style={{...theme.labels.subtitle, fontWeight: Platform.OS === 'ios' ? '600' : 'bold'}} mBottom={10}>{category.name}</OText>
97
101
  </TouchableOpacity>
98
- <ScrollView horizontal showsHorizontalScrollIndicator={false}>
102
+ <ProductsWrapper>
99
103
  {
100
104
  products.map((product: any, index: number) => (
101
105
  <SingleProductCard
@@ -107,7 +111,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
107
111
  />
108
112
  ))
109
113
  }
110
- </ScrollView>
114
+ </ProductsWrapper>
111
115
  </>
112
116
  )
113
117
  }
@@ -118,29 +122,27 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
118
122
 
119
123
  {
120
124
  (categoryState.loading || isBusinessLoading) && (
121
- <>
125
+ <Placeholder style={{ padding: 5, marginBottom: 20 }} Animation={Fade}>
126
+ <PlaceholderLine width={50} height={16} style={{ marginBottom: 20 }} />
122
127
  {[...Array(categoryState?.pagination?.nextPageItems).keys()].map((item, i) => (
123
- <Placeholder key={i} style={{ padding: 5, marginBottom: 20 }} Animation={Fade}>
124
- <PlaceholderLine width={50} height={20} style={{ marginBottom: 20 }} />
125
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
126
- <View style={{flexBasis: '47%'}}>
127
- <PlaceholderLine width={80} height={100} style={{ marginBottom: 10 }} />
128
- <Placeholder>
129
- <PlaceholderLine width={60} style={{marginBottom: 12}}/>
130
- <PlaceholderLine width={20} />
131
- </Placeholder>
132
- </View>
133
- <View style={{flexBasis: '47%'}}>
134
- <PlaceholderLine width={80} height={100} style={{ marginBottom: 10 }} />
135
- <Placeholder>
136
- <PlaceholderLine width={60} style={{marginBottom: 25}}/>
137
- <PlaceholderLine width={20} />
138
- </Placeholder>
139
- </View>
128
+ <View key={i} style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
129
+ <View style={{flexBasis: '47%'}}>
130
+ <PlaceholderLine width={80} height={100} style={{ marginBottom: 10 }} />
131
+ <Placeholder>
132
+ <PlaceholderLine width={20} />
133
+ <PlaceholderLine width={60} style={{marginBottom: 12}}/>
134
+ </Placeholder>
140
135
  </View>
141
- </Placeholder>
136
+ <View style={{flexBasis: '47%'}}>
137
+ <PlaceholderLine width={80} height={100} style={{ marginBottom: 10 }} />
138
+ <Placeholder>
139
+ <PlaceholderLine width={20} />
140
+ <PlaceholderLine width={60} style={{marginBottom: 25}}/>
141
+ </Placeholder>
142
+ </View>
143
+ </View>
142
144
  ))}
143
- </>
145
+ </Placeholder>
144
146
  )
145
147
  }
146
148
  {
@@ -11,4 +11,9 @@ export const ErrorMessage = styled.View`
11
11
 
12
12
  export const WrapperNotFound = styled.View`
13
13
  height: 500px;
14
- `
14
+ `
15
+ export const ProductsWrapper = styled.View`
16
+ flex-direction: row;
17
+ flex-wrap: wrap;
18
+ align-items: flex-start;
19
+ `
@@ -1,6 +1,5 @@
1
- import React, { useState } from 'react'
2
- import { View, TouchableOpacity, StyleSheet, ScrollView } from 'react-native'
3
- import MaterialIcon from 'react-native-vector-icons/MaterialIcons'
1
+ import React, { useEffect, useState } from 'react'
2
+ import { View, StyleSheet, ScrollView, Animated, Dimensions } from 'react-native'
4
3
  import {
5
4
  BusinessAndProductList,
6
5
  useLanguage,
@@ -28,13 +27,14 @@ import { FloatingButton } from '../FloatingButton'
28
27
  import { ProductForm } from '../ProductForm'
29
28
  import { UpsellingProducts } from '../UpsellingProducts'
30
29
  import { useTheme } from 'styled-components/native'
31
- import { useSafeAreaInsets } from 'react-native-safe-area-context'
32
30
  import { OrderSummary } from '../OrderSummary'
33
31
  import { Cart } from '../Cart'
34
- import { SingleProductCard } from '../../../../../src/components/SingleProductCard'
32
+ import { SingleProductCard } from '../SingleProductCard'
35
33
  import NavBar from '../NavBar'
36
34
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
37
35
 
36
+ const { width, height } = Dimensions.get('screen')
37
+
38
38
  const PIXELS_TO_SCROLL = 1000
39
39
 
40
40
  const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
@@ -58,6 +58,43 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
58
58
  updateProductModal
59
59
  } = props
60
60
 
61
+ const styles = StyleSheet.create({
62
+ mainContainer: {
63
+ flex: 1,
64
+ display: categorySelected.id !== null ? 'none' : 'flex'
65
+ },
66
+ BackIcon: {
67
+ paddingRight: 20,
68
+ },
69
+ headerItem: {
70
+ flexDirection: 'row',
71
+ alignItems: 'center',
72
+ marginHorizontal: 20,
73
+ },
74
+ btnBackArrow: {
75
+ borderWidth: 0,
76
+ color: '#FFF',
77
+ backgroundColor: 'rgba(0,0,0,0.3)',
78
+ borderRadius: 16,
79
+ paddingHorizontal: 15,
80
+ marginRight: 15,
81
+ marginTop: 20
82
+ },
83
+ searchIcon: {
84
+ borderWidth: 0,
85
+ color: '#FFF',
86
+ backgroundColor: 'rgba(0,0,0,0.3)',
87
+ borderRadius: 24,
88
+ padding: 15,
89
+ justifyContent: 'center'
90
+ },
91
+ productsWrapper: {
92
+ flexDirection: 'row',
93
+ flexWrap: 'wrap',
94
+ alignItems: 'flex-start'
95
+ }
96
+ })
97
+
61
98
  const theme = useTheme()
62
99
  const [, t] = useLanguage()
63
100
  const [{ auth }] = useSession()
@@ -71,7 +108,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
71
108
  const [canOpenUpselling, setCanOpenUpselling] = useState(false)
72
109
  const [openCart, setOpenCart] = useState(false)
73
110
 
74
- const { top, bottom } = useSafeAreaInsets();
111
+ const [alignment] = useState(new Animated.Value(0))
112
+ const actionSheetIntropolate = alignment.interpolate({
113
+ inputRange: [0, 1],
114
+ outputRange: [-height, 0]
115
+ })
75
116
 
76
117
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
77
118
 
@@ -117,6 +158,22 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
117
158
  }
118
159
  }
119
160
 
161
+ useEffect(() => {
162
+ if (categorySelected.id === null) {
163
+ Animated.timing(alignment, {
164
+ toValue: 0,
165
+ duration: 500,
166
+ useNativeDriver: false
167
+ }).start()
168
+ } else {
169
+ Animated.timing(alignment, {
170
+ toValue: 1,
171
+ duration: 500,
172
+ useNativeDriver: false
173
+ }).start()
174
+ }
175
+ }, [categorySelected.id])
176
+
120
177
  return (
121
178
  <>
122
179
  <BusinessProductsListingContainer
@@ -129,7 +186,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
129
186
  <WrapHeader>
130
187
  {!loading && business?.id && (
131
188
  <>
132
- <TopHeader style={{ marginTop: top }}>
189
+ <TopHeader>
133
190
  <View style={{ ...styles.headerItem, flex: 1 }}>
134
191
  <OButton
135
192
  imgLeftSrc={theme.images.general.arrow_left}
@@ -213,6 +270,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
213
270
  handleClick={() => onRedirect('CartPage', { cart: currentCart })}
214
271
  />
215
272
  )}
273
+
216
274
  <OModal
217
275
  open={!!curProduct || (!!productModal.product && !orderState.loading)}
218
276
  onClose={handleCloseProductModal}
@@ -230,18 +288,16 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
230
288
  />
231
289
  </OModal>
232
290
 
233
- <OModal
234
- open={categorySelected.id !== null}
235
- onClose={() => handleChangeCategory({ id: null, name: 'All' })}
236
- entireModal
237
- customClose
238
- >
239
- <ScrollView
291
+ {categorySelected.id !== null && (
292
+ <Animated.ScrollView
240
293
  contentContainerStyle={{
241
294
  paddingHorizontal: 40,
242
295
  paddingVertical: 20
243
296
  }}
244
297
  onScroll={(e: any) => handleScroll(e)}
298
+ style={{
299
+ bottom: actionSheetIntropolate
300
+ }}
245
301
  >
246
302
  <NavBar
247
303
  title={categorySelected?.name}
@@ -249,7 +305,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
249
305
  showCall={false}
250
306
  style={{ paddingHorizontal: 0, marginHorizontal: -7 }}
251
307
  />
252
- <View>
308
+ <View style={styles.productsWrapper}>
253
309
  {categorySelected.id && (
254
310
  categoryState.products?.map((product: any, index: number) => (
255
311
  <SingleProductCard
@@ -265,27 +321,30 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
265
321
 
266
322
  {
267
323
  categoryState.loading && (
268
- <>
269
- {[...Array(10).keys()].map((item, i) => (
270
- <Placeholder key={i} style={{ marginBottom: 10 }} Animation={Fade}>
271
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
272
- <View
273
- style={{ width: 80, height: 80 }}
274
- >
275
- <PlaceholderLine width={80} height={70} />
324
+ <Placeholder style={{ padding: 5, marginBottom: 20 }} Animation={Fade}>
325
+ {[...Array(categoryState?.pagination?.nextPageItems).keys()].map((item, i) => (
326
+ <View key={i} style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
327
+ <View style={{flexBasis: '47%'}}>
328
+ <PlaceholderLine width={80} height={100} style={{ marginBottom: 10 }} />
329
+ <Placeholder>
330
+ <PlaceholderLine width={20} />
331
+ <PlaceholderLine width={60} style={{marginBottom: 12}}/>
332
+ </Placeholder>
276
333
  </View>
334
+ <View style={{flexBasis: '47%'}}>
335
+ <PlaceholderLine width={80} height={100} style={{ marginBottom: 10 }} />
277
336
  <Placeholder>
278
- <PlaceholderLine width={60} style={{marginBottom: 30}}/>
279
337
  <PlaceholderLine width={20} />
338
+ <PlaceholderLine width={60} style={{marginBottom: 25}}/>
280
339
  </Placeholder>
340
+ </View>
281
341
  </View>
342
+ ))}
282
343
  </Placeholder>
283
- ))}
284
- </>
285
344
  )
286
345
  }
287
- </ScrollView>
288
- </OModal>
346
+ </Animated.ScrollView>
347
+ )}
289
348
 
290
349
  {openUpselling && (
291
350
  <UpsellingProducts
@@ -302,37 +361,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
302
361
  )
303
362
  }
304
363
 
305
- const styles = StyleSheet.create({
306
- mainContainer: {
307
- flex: 1,
308
- },
309
- BackIcon: {
310
- paddingRight: 20,
311
- },
312
- headerItem: {
313
- flexDirection: 'row',
314
- alignItems: 'center',
315
- marginHorizontal: 20,
316
- },
317
- btnBackArrow: {
318
- borderWidth: 0,
319
- color: '#FFF',
320
- backgroundColor: 'rgba(0,0,0,0.3)',
321
- borderRadius: 16,
322
- paddingHorizontal: 15,
323
- marginRight: 15,
324
- marginTop: 20
325
- },
326
- searchIcon: {
327
- borderWidth: 0,
328
- color: '#FFF',
329
- backgroundColor: 'rgba(0,0,0,0.3)',
330
- borderRadius: 24,
331
- padding: 15,
332
- justifyContent: 'center'
333
- }
334
- })
335
-
336
364
  export const BusinessProductsListing = (props: BusinessProductsListingParams) => {
337
365
  const businessProductslistingProps = {
338
366
  ...props,
@@ -1,4 +1,4 @@
1
- import React, {useEffect} from 'react'
1
+ import React from 'react'
2
2
  import { useLanguage, useConfig, useOrder, useUtils } from 'ordering-components/native'
3
3
  import { SingleProductCardParams } from '../../types'
4
4
  import {
@@ -23,9 +23,8 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
23
23
 
24
24
  const styles = StyleSheet.create({
25
25
  container: {
26
- marginBottom: 15,
27
- width: (windowWidth - 140) / 2,
28
- minHeight: (windowWidth - 140) / 2 + 50
26
+ width: (windowWidth - 80) / 2,
27
+ height: (windowWidth - 80) / 2 + 40
29
28
  },
30
29
  textStyle: {
31
30
  flex: 1,
@@ -37,8 +36,8 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
37
36
  lineHeight: 18
38
37
  },
39
38
  productStyle: {
40
- width: (windowWidth - 200) / 2,
41
- height: (windowWidth - 200) / 2,
39
+ width: (windowWidth - 160) / 2,
40
+ height: (windowWidth - 160) / 2,
42
41
  borderRadius: 3,
43
42
  marginTop: 5
44
43
  },
@@ -70,10 +69,6 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
70
69
 
71
70
  const maxProductQuantity = Math.min(maxCartProductConfig, maxCartProductInventory)
72
71
 
73
- useEffect(() => {
74
-
75
- }, [product]);
76
-
77
72
  return (
78
73
  <CardContainer style={styles.container}
79
74
  onPress={() => onProductClick?.(product)}
@@ -1,11 +1,11 @@
1
1
  import styled from 'styled-components/native'
2
2
 
3
3
  export const CardContainer = styled.TouchableOpacity`
4
- flex: 1;
4
+ /* flex-grow: 1; */
5
5
  align-items: flex-start;
6
6
  padding: 10px;
7
7
  position: relative;
8
- margin-end: 10px;
8
+ /* margin-end: 10px; */
9
9
  border-radius: 3px;
10
10
  `
11
11
  export const CardInfo = styled.View`
@@ -162,7 +162,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
162
162
  ? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.145 :orientationState?.dimensions?.width * 0.16
163
163
  : orientationState?.dimensions?.width * 0.20
164
164
  }}
165
- titleStyle={{marginTop: Platform.OS === 'ios' ? 10 : 0}}
165
+ titleStyle={{marginTop: Platform.OS === 'ios' ? orientationState?.orientation === LANDSCAPE ? orientationState?.dimensions.height * 0.05 : orientationState?.dimensions.width * 0.05 : 0}}
166
166
  onPress={() => {
167
167
  resetInactivityTimeout()
168
168
  if (isDrawer) {
@@ -14,7 +14,6 @@ import {
14
14
  LoadMore
15
15
  } from './styles';
16
16
  import { View, StyleSheet } from 'react-native';
17
- import { getGoogleMapImage } from '../../utils';
18
17
 
19
18
  import { ActiveOrdersParams } from '../../types';
20
19
  import moment from 'moment';
@@ -41,7 +40,7 @@ export const ActiveOrders = (props: ActiveOrdersParams) => {
41
40
  };
42
41
 
43
42
  const handleClickCard = (uuid: string) => {
44
- if (isMessageView ) {
43
+ if (isMessageView) {
45
44
  handleClickOrder(uuid)
46
45
  return
47
46
  }
@@ -132,18 +131,8 @@ export const ActiveOrders = (props: ActiveOrdersParams) => {
132
131
  <ActiveOrdersContainer isMiniCards={configs?.google_maps_api_key?.value}>
133
132
  {orders.length > 0 &&
134
133
  orders.map((order: any, index: any) => (
135
- <Order key={order?.id || order?.uuid} order={order} index={index} />
134
+ <Order key={index} order={order} index={index} />
136
135
  ))}
137
- {pagination?.totalPages && pagination?.currentPage < pagination?.totalPages && (
138
- <LoadMore>
139
- <OButton
140
- textStyle={{ color: '#fff' }}
141
- text={t('LOAD_MORE_ORDERS', 'Load more orders')}
142
- onClick={loadMoreOrders}
143
- style={styles.loadMoreButton}
144
- />
145
- </LoadMore>
146
- )}
147
136
  </ActiveOrdersContainer>
148
137
  <View
149
138
  style={{
@@ -104,6 +104,9 @@ const MomentOptionUI = (props: MomentOptionParams) => {
104
104
 
105
105
  const [toggleTime, setToggleTime] = useState(false);
106
106
  const [selectedTime, setSelectedTime] = useState(timeSelected);
107
+ const [minDate, setMinDate] = useState(new Date())
108
+ const [maxDate, setMaxDate] = useState(new Date)
109
+ const [alert, setAlert] = useState<any>({ show: false })
107
110
 
108
111
  const goToBack = () => navigation?.canGoBack() && navigation.goBack();
109
112
 
@@ -173,6 +176,19 @@ const MomentOptionUI = (props: MomentOptionParams) => {
173
176
  },
174
177
  };
175
178
  };
179
+
180
+ useEffect(() => {
181
+ if (datesList?.length > 0) {
182
+ const _datesList = datesList.slice(0, Number(configs?.max_days_preorder?.value || 6))
183
+ const minDateParts = _datesList[0].split('-')
184
+ const maxDateParts = _datesList[_datesList.length - 1].split('-')
185
+ const _minDate = new Date(minDateParts[0], minDateParts[1] - 1, minDateParts[2])
186
+ const _maxDate = new Date(maxDateParts[0], maxDateParts[1] - 1, maxDateParts[2])
187
+ setMinDate(_minDate)
188
+ setMaxDate(_maxDate)
189
+ }
190
+ }, [datesList])
191
+
176
192
  return (
177
193
  <>
178
194
  <Container style={{ paddingLeft: 40, paddingRight: 40 }}>
@@ -309,7 +325,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
309
325
  customDayHeaderStyles={customDayHeaderStylesCallback}
310
326
  weekdays={weekDays}
311
327
  selectedStartDate={momento}
312
- minDate={moment()}
328
+ minDate={minDate}
329
+ maxDate={maxDate}
313
330
  />
314
331
  </View>
315
332
  )}
@@ -0,0 +1,56 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage } from 'ordering-components/native';
3
+ import { View, StyleSheet, Platform, I18nManager } from 'react-native';
4
+
5
+ import { OrdersOption } from '../OrdersOption'
6
+ import { OText } from '../shared'
7
+ import { ScrollView } from 'react-native-gesture-handler';
8
+
9
+ const PIXELS_TO_SCROLL = 1000;
10
+
11
+ export const MyOrders = (props: any) => {
12
+ const [, t] = useLanguage();
13
+ const [loadMore, setLoadMore] = useState(false)
14
+
15
+ const [ordersLength, setOrdersLength] = useState({
16
+ activeOrdersLength: 0,
17
+ previousOrdersLength: 0,
18
+ });
19
+
20
+ const handleScroll = ({ nativeEvent }: any) => {
21
+ const y = nativeEvent.contentOffset.y
22
+ const height = nativeEvent.contentSize.height
23
+
24
+ if (y + PIXELS_TO_SCROLL > height ) {
25
+ setLoadMore(true)
26
+ }
27
+ }
28
+
29
+ return (
30
+ <ScrollView onScroll={(e: any) => handleScroll(e)}>
31
+ <OText
32
+ size={20}
33
+ mBottom={15}
34
+ style={{ marginTop: 25, paddingHorizontal: 40 }}>
35
+ {t('MY_ORDERS', 'My Orders')}
36
+ </OText>
37
+ <View style={{ paddingLeft: 40, paddingRight: 40 }}>
38
+ <OrdersOption
39
+ {...props}
40
+ activeOrders
41
+ ordersLength={ordersLength}
42
+ setOrdersLength={setOrdersLength}
43
+ loadMoreStatus={loadMore}
44
+ setLoadMoreStatus={setLoadMore}
45
+ />
46
+ </View>
47
+ <View style={{ paddingLeft: 40, paddingRight: 40 }}>
48
+ <OrdersOption
49
+ {...props}
50
+ ordersLength={ordersLength}
51
+ setOrdersLength={setOrdersLength}
52
+ />
53
+ </View>
54
+ </ScrollView>
55
+ )
56
+ }
@@ -0,0 +1,6 @@
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const Wrapper = styled.View`
4
+ flex: 1;
5
+ background-color: ${(props: any) => props.theme.colors.white};
6
+ `
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react'
1
+ import React, { useState, useEffect } from 'react'
2
2
  import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useFocusEffect } from '@react-navigation/native'
@@ -15,7 +15,8 @@ import {
15
15
  PlaceholderLine,
16
16
  Fade
17
17
  } from "rn-placeholder";
18
- import { View } from 'react-native'
18
+
19
+ import { View, ScrollView } from 'react-native'
19
20
 
20
21
  const OrdersOptionUI = (props: OrdersOptionParams) => {
21
22
  const {
@@ -28,8 +29,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
28
29
  customArray,
29
30
  onNavigationRedirect,
30
31
  orderStatus,
32
+ loadMoreStatus,
31
33
  loadMoreOrders,
32
- loadOrders
34
+ loadOrders,
33
35
  } = props
34
36
 
35
37
  const theme = useTheme();
@@ -98,10 +100,17 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
98
100
  }
99
101
 
100
102
  useFocusEffect(
101
- React.useCallback(() => {
102
- loadOrders()
103
- }, [navigation])
104
- )
103
+ React.useCallback(() => {
104
+ loadOrders()
105
+ }, [navigation])
106
+ )
107
+
108
+ useEffect(() => {
109
+ const hasMore = pagination?.totalPages && pagination?.currentPage !== pagination?.totalPages
110
+ if (loadMoreStatus && hasMore && !loading) {
111
+ loadMoreOrders()
112
+ }
113
+ }, [loadMoreStatus, loading, pagination])
105
114
 
106
115
  return (
107
116
  <>
@@ -127,7 +136,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
127
136
  )}
128
137
  {loading && (
129
138
  <>
130
- {activeOrders ? (
139
+ {!activeOrders ? (
131
140
  <Placeholder style={{ marginTop: 30 }} Animation={Fade}>
132
141
  <View style={{ width: '100%', flexDirection: 'row' }}>
133
142
  <PlaceholderLine width={20} height={70} style={{ marginRight: 20, marginBottom: 35 }} />
@@ -171,7 +180,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
171
180
  <ActiveOrders
172
181
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
173
182
  pagination={pagination}
174
- loadMoreOrders={loadMoreOrders}
175
183
  reorderLoading={reorderLoading}
176
184
  customArray={customArray}
177
185
  getOrderStatus={getOrderStatus}
@@ -201,11 +209,6 @@ export const OrdersOption = (props: OrdersOptionParams) => {
201
209
  ? [0, 3, 4, 7, 8, 9, 14, 15, 18, 19, 20, 21]
202
210
  : [1, 2, 5, 6, 10, 11, 12, 16, 17],
203
211
  useDefualtSessionManager: true,
204
- paginationSettings: {
205
- initialPage: 1,
206
- pageSize: 10,
207
- controlType: 'infinity'
208
- }
209
212
  }
210
213
 
211
214
  return <OrderList {...MyOrdersProps} />
@@ -253,7 +253,7 @@ export interface OrdersOptionParams {
253
253
  pagination?: any,
254
254
  titleContent?: string,
255
255
  customArray?: Array<any>,
256
- loadMoreOrders?: () => {},
256
+ loadMoreOrders?: any,
257
257
  onNavigationRedirect?: any,
258
258
  orderStatus?: any,
259
259
  navigation?: any,
@@ -263,7 +263,8 @@ export interface OrdersOptionParams {
263
263
  setOrdersLength?: ({ activeOrdersLength, previousOrdersLength }: { activeOrdersLength: number, previousOrdersLength: number }) => void,
264
264
  ordersLength: { activeOrdersLength: number, previousOrdersLength: number },
265
265
  setSelectedOrderId?: any,
266
- setOpenMessges?: any
266
+ setOpenMessges?: any,
267
+ loadMoreStatus?: boolean
267
268
  }
268
269
  export interface ActiveOrdersParams {
269
270
  orders?: any,
@@ -1 +0,0 @@
1
- declare module 'react-native-fbsdk';