ordering-ui-react-native 0.13.6 → 0.13.7
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 +2 -2
- package/src/DeliveryApp.tsx +2 -0
- package/src/components/FacebookLogin/index.tsx +2 -2
- package/src/components/FacebookPixel/index.tsx +81 -0
- package/src/components/LoginForm/index.tsx +7 -7
- package/src/types/react-native-fbsdk-next/index.d.ts +1 -0
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -1
- package/themes/original/src/components/ActiveOrders/index.tsx +2 -13
- package/themes/original/src/components/MyOrders/index.tsx +56 -0
- package/themes/original/src/components/MyOrders/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +17 -14
- package/themes/original/src/types/index.tsx +3 -2
- package/src/types/react-native-fbsdk/index.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-react-native",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.7",
|
|
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": "^
|
|
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",
|
package/src/DeliveryApp.tsx
CHANGED
|
@@ -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
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'react-native-fbsdk-next';
|
|
@@ -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' ?
|
|
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={
|
|
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={{
|
|
@@ -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
|
+
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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';
|