ordering-ui-react-native 0.14.83 → 0.14.85-release
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 +6 -3
- package/src/DeliveryApp.tsx +34 -2
- package/src/assets/images/no-network.png +0 -0
- package/src/components/BusinessTypeFilter/index.tsx +9 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Cart/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/Home/index.tsx +3 -5
- package/src/components/LanguageSelector/index.tsx +65 -97
- package/src/components/LanguageSelector/styles.tsx +4 -17
- package/src/components/Messages/index.tsx +38 -30
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +29 -6
- package/src/components/OrdersOption/index.tsx +4 -2
- package/src/components/PaymentOptions/index.tsx +7 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +35 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/providers/AlertProvider.tsx +4 -1
- package/src/theme.json +2 -1
- package/src/types/index.tsx +2 -9
- package/src/utils/index.tsx +196 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/Chat/index.tsx +32 -31
- package/themes/business/src/components/NetworkError/index.tsx +61 -0
- package/themes/business/src/components/NetworkError/styles.tsx +11 -0
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- package/themes/business/src/components/OrdersListManager/index.tsx +871 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +354 -54
- package/themes/business/src/components/OrdersOption/styles.tsx +95 -7
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +65 -46
- package/themes/business/src/components/PreviousOrders/styles.tsx +5 -10
- package/themes/business/src/components/ReviewCustomer/index.tsx +11 -8
- package/themes/business/src/types/index.tsx +4 -0
- package/themes/business/src/utils/index.tsx +12 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/doordash/src/components/OrderDetails/index.tsx +3 -1
- package/themes/doordash/src/components/OrdersOption/index.tsx +4 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/instacart/src/components/OrderDetails/index.tsx +3 -1
- package/themes/instacart/src/components/OrdersOption/index.tsx +4 -2
- package/themes/kiosk/index.tsx +2 -0
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/NetworkError/index.tsx +60 -0
- package/themes/kiosk/src/components/NetworkError/styles.tsx +11 -0
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/kiosk/src/types/index.d.ts +4 -0
- package/themes/original/index.tsx +26 -6
- package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +11 -7
- package/themes/original/src/components/BusinessController/index.tsx +2 -2
- package/themes/original/src/components/BusinessMenuList/index.tsx +4 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +3 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +50 -6
- package/themes/original/src/components/BusinessProductsListing/index.tsx +13 -10
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
- package/themes/original/src/components/BusinessesListing/index.tsx +20 -11
- package/themes/original/src/components/Cart/index.tsx +43 -10
- package/themes/original/src/components/Checkout/index.tsx +54 -17
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +9 -2
- package/themes/original/src/components/LastOrder/index.tsx +3 -1
- package/themes/original/src/components/LoginForm/index.tsx +83 -68
- package/themes/original/src/components/MessageListing/index.tsx +4 -2
- package/themes/original/src/components/Messages/index.tsx +19 -21
- package/themes/original/src/components/MomentOption/index.tsx +127 -152
- package/themes/original/src/components/MomentOption/styles.tsx +42 -18
- package/themes/original/src/components/NetworkError/index.tsx +61 -0
- package/themes/original/src/components/NetworkError/styles.tsx +11 -0
- package/themes/original/src/components/OrderDetails/index.tsx +106 -113
- package/themes/original/src/components/OrderProgress/index.tsx +6 -5
- package/themes/original/src/components/OrderSummary/index.tsx +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +20 -42
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +20 -23
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +4 -0
- package/themes/original/src/components/ProductForm/index.tsx +35 -20
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +81 -74
- package/themes/original/src/components/ReviewDriver/index.tsx +315 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +38 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +307 -186
- package/themes/original/src/components/ReviewOrder/styles.tsx +24 -13
- package/themes/original/src/components/ReviewProducts/index.tsx +116 -0
- package/themes/original/src/components/ReviewProducts/styles.tsx +16 -0
- package/themes/original/src/components/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/SingleProductCard/index.tsx +6 -13
- package/themes/original/src/components/SingleProductCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductReview/index.tsx +166 -0
- package/themes/original/src/components/SingleProductReview/styles.tsx +27 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +13 -6
- package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +26 -0
- package/themes/original/src/types/index.tsx +47 -10
- package/themes/single-business/src/components/LastOrder/index.tsx +3 -1
- package/themes/single-business/src/components/OrderDetails/index.tsx +15 -0
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- package/themes/single-business/src/components/OrdersOption/index.tsx +4 -2
- package/themes/single-business/src/utils/index.tsx +7 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/uber-eats/src/components/OrderDetails/index.tsx +3 -1
- package/themes/uber-eats/src/components/OrdersOption/index.tsx +4 -2
- package/src/components/StripeMethodForm/index.tsx +0 -163
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-react-native",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.85-release",
|
|
4
4
|
"description": "Reusable components made in react native",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"author": "ordering.inc",
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
"@react-navigation/material-bottom-tabs": "^5.3.14",
|
|
49
49
|
"@react-navigation/native": "^5.7.6",
|
|
50
50
|
"@react-navigation/stack": "^5.9.3",
|
|
51
|
+
"@segment/analytics-react-native": "^2.1.11",
|
|
52
|
+
"@segment/sovran-react-native": "^0.2.6",
|
|
51
53
|
"@sentry/react-native": "^2.6.0",
|
|
52
54
|
"@stripe/stripe-react-native": "^0.2.0",
|
|
53
55
|
"@types/react-native-loading-spinner-overlay": "^0.5.2",
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
"@types/styled-components": "^5.1.3",
|
|
56
58
|
"axios": "^0.21.0",
|
|
57
59
|
"moment": "^2.29.1",
|
|
58
|
-
"ordering-components": "github:Ordering-Inc/ordering-components#
|
|
60
|
+
"ordering-components": "github:Ordering-Inc/ordering-components#release",
|
|
59
61
|
"patch-package": "^6.4.7",
|
|
60
62
|
"postinstall-postinstall": "^2.1.0",
|
|
61
63
|
"prop-types": "^15.7.2",
|
|
@@ -69,10 +71,11 @@
|
|
|
69
71
|
"react-native-background-timer": "^2.4.1",
|
|
70
72
|
"react-native-bootsplash": "^3.2.3",
|
|
71
73
|
"react-native-calendar-picker": "^7.1.2",
|
|
72
|
-
"react-native-calendar-strip": "^2.2.
|
|
74
|
+
"react-native-calendar-strip": "^2.2.1",
|
|
73
75
|
"react-native-color-matrix-image-filters": "^5.2.10",
|
|
74
76
|
"react-native-country-picker-modal": "^2.0.0",
|
|
75
77
|
"react-native-credit-card-input": "^0.4.1",
|
|
78
|
+
"react-native-device-info": "^8.7.1",
|
|
76
79
|
"react-native-document-picker": "^5.2.0",
|
|
77
80
|
"react-native-elements": "^3.0.0-alpha.1",
|
|
78
81
|
"react-native-fast-image": "^8.3.3",
|
package/src/DeliveryApp.tsx
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as React from 'react';
|
|
10
|
-
import { LogBox } from 'react-native';
|
|
10
|
+
import { LogBox, Platform } from 'react-native';
|
|
11
|
+
import * as Sentry from "@sentry/react-native";
|
|
11
12
|
import { OrderingProvider } from 'ordering-components/native';
|
|
12
13
|
import RNBootSplash from "react-native-bootsplash";
|
|
13
14
|
|
|
@@ -22,6 +23,36 @@ import theme from './theme.json';
|
|
|
22
23
|
import AppContainer from './AppContainer';
|
|
23
24
|
import { FacebookPixel } from './components/FacebookPixel';
|
|
24
25
|
|
|
26
|
+
Sentry.init({
|
|
27
|
+
environment: Platform.OS === 'ios' ? 'ios' : 'android',
|
|
28
|
+
dsn: 'https://e5e1115dc93b49109f4ab65f2098bef9@o460529.ingest.sentry.io/5722123',
|
|
29
|
+
release: process.env.npm_package_version ? 'ordering-ui-native@' + process.env.npm_package_version : 'ordering-ui-native@' + '0.0.4',
|
|
30
|
+
ignoreErrors: [
|
|
31
|
+
'is not defined',
|
|
32
|
+
'is not a function',
|
|
33
|
+
'can\'t find variable',
|
|
34
|
+
'objects are not valid',
|
|
35
|
+
'element type is invalid',
|
|
36
|
+
'requiring module',
|
|
37
|
+
'has not been registered',
|
|
38
|
+
'failed to connect to debugger!',
|
|
39
|
+
'rendered more hooks than',
|
|
40
|
+
'rendered fewer hooks than',
|
|
41
|
+
'should have a queue',
|
|
42
|
+
'the OS most likely terminated',
|
|
43
|
+
'Connection timed out',
|
|
44
|
+
'java.io.EOFException',
|
|
45
|
+
'Abort',
|
|
46
|
+
'Segfault',
|
|
47
|
+
'Failed to allocate a',
|
|
48
|
+
'Application Not Responding',
|
|
49
|
+
'connection no longer valid',
|
|
50
|
+
'IllegalInstruction',
|
|
51
|
+
'React.Children.only expected to receive a single React element child.',
|
|
52
|
+
'unrecognized selector sent to instance'
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
|
|
25
56
|
LogBox.ignoreLogs([
|
|
26
57
|
'Sending \`onAnimatedValueUpdate` with no listeners registered.',
|
|
27
58
|
'Non-serializable values were found in the navigation state.',
|
|
@@ -88,7 +119,8 @@ theme.images = {
|
|
|
88
119
|
close: require('./assets/icons/close.png'),
|
|
89
120
|
orderCreating: require('./assets/images/order-creating.png'),
|
|
90
121
|
orderSuccess: require('./assets/images/order-success.png'),
|
|
91
|
-
newOrder: require('./assets/images/new-order.png')
|
|
122
|
+
newOrder: require('./assets/images/new-order.png'),
|
|
123
|
+
noNetwork: require('./assets/images/no-network.png')
|
|
92
124
|
},
|
|
93
125
|
order: {
|
|
94
126
|
status0: require('./assets/images/status-0.png'),
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { StyleSheet, View, ScrollView, TouchableOpacity, Dimensions } from 'react-native'
|
|
2
|
+
import { StyleSheet, View, ScrollView, TouchableOpacity, Dimensions, Platform, PlatformIOSStatic } from 'react-native'
|
|
3
3
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
4
4
|
import { BusinessTypeFilter as BusinessTypeFilterController, useLanguage } from 'ordering-components/native'
|
|
5
5
|
|
|
@@ -8,6 +8,7 @@ import { OIcon, OText, OModal } from '../shared'
|
|
|
8
8
|
import { BusinessTypeFilterParams } from '../../types'
|
|
9
9
|
import { useTheme } from 'styled-components/native'
|
|
10
10
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
11
|
+
import DeviceInfo from 'react-native-device-info';
|
|
11
12
|
|
|
12
13
|
const windowWidth = Dimensions.get('window').width;
|
|
13
14
|
|
|
@@ -18,6 +19,10 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
18
19
|
handleChangeBusinessType,
|
|
19
20
|
} = props;
|
|
20
21
|
|
|
22
|
+
const platformIOS = Platform as PlatformIOSStatic
|
|
23
|
+
const isIpad = platformIOS.isPad
|
|
24
|
+
const isTablet = DeviceInfo.isTablet();
|
|
25
|
+
|
|
21
26
|
const theme = useTheme();
|
|
22
27
|
const [, t] = useLanguage();
|
|
23
28
|
const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
|
|
@@ -122,7 +127,9 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
122
127
|
{t('BUSINESS_CATEGORIES', 'Business Categories')}
|
|
123
128
|
</OText>
|
|
124
129
|
</BusinessCategoriesTitle>
|
|
125
|
-
<BusinessCategories
|
|
130
|
+
<BusinessCategories
|
|
131
|
+
mt={(isIpad || isTablet) ? 65 : null}
|
|
132
|
+
>
|
|
126
133
|
{typesState?.types.slice(0, 3).map((type: any) => (
|
|
127
134
|
<RenderTypes
|
|
128
135
|
key={type.id}
|
|
@@ -18,7 +18,7 @@ export const BusinessCategories = styled.View`
|
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-direction: row;
|
|
20
20
|
justify-content: space-between;
|
|
21
|
-
margin:
|
|
21
|
+
margin: ${(props: any) => props.mt ?? 10}px 0px 10px;
|
|
22
22
|
width: 100%;
|
|
23
23
|
`
|
|
24
24
|
export const Category = styled.View`
|
|
@@ -191,7 +191,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
191
191
|
{isFarAway && (
|
|
192
192
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
193
193
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
194
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
194
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
|
|
195
195
|
</FarAwayMessage>
|
|
196
196
|
)}
|
|
197
197
|
</OrderControlContainer>
|
|
@@ -220,7 +220,7 @@ const CartUI = (props: any) => {
|
|
|
220
220
|
<OSRow>
|
|
221
221
|
<OText numberOfLines={1}>
|
|
222
222
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
223
|
-
({parsePrice(fee?.fixed)} + {fee
|
|
223
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
|
|
224
224
|
</OText>
|
|
225
225
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
|
|
226
226
|
<AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useLanguage, useOrder } from 'ordering-components/native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import { StyleSheet, View, Dimensions } from 'react-native';
|
|
4
|
+
import { StyleSheet, View, Dimensions, Platform, useWindowDimensions } from 'react-native';
|
|
5
5
|
import { OButton, OIcon, OText } from '../shared';
|
|
6
6
|
import { LogoWrapper, Slogan } from './styles';
|
|
7
7
|
import { LanguageSelector } from '../LanguageSelector'
|
|
@@ -11,6 +11,7 @@ import { _setStoreData } from '../../providers/StoreUtil';
|
|
|
11
11
|
const windowHeight = Dimensions.get('window').height
|
|
12
12
|
|
|
13
13
|
export const Home = (props: any) => {
|
|
14
|
+
const { width, height } = useWindowDimensions();
|
|
14
15
|
const { onNavigationRedirect } = props;
|
|
15
16
|
|
|
16
17
|
const theme = useTheme();
|
|
@@ -25,7 +26,7 @@ export const Home = (props: any) => {
|
|
|
25
26
|
return (
|
|
26
27
|
<View style={styles.container}>
|
|
27
28
|
<View style={styles.wrapperContent}>
|
|
28
|
-
<View style={
|
|
29
|
+
<View style={{ paddingTop: (height <= 756 && Platform.OS !== 'ios') ? (height * 0.05) : 0, marginLeft: 10 }}>
|
|
29
30
|
<LanguageSelector />
|
|
30
31
|
</View>
|
|
31
32
|
<LogoWrapper>
|
|
@@ -74,9 +75,6 @@ export const Home = (props: any) => {
|
|
|
74
75
|
};
|
|
75
76
|
|
|
76
77
|
const styles = StyleSheet.create({
|
|
77
|
-
languageSelector: {
|
|
78
|
-
marginRight: 10
|
|
79
|
-
},
|
|
80
78
|
textLink: {
|
|
81
79
|
flexDirection: 'row',
|
|
82
80
|
textAlign: 'center',
|
|
@@ -1,140 +1,108 @@
|
|
|
1
|
-
import React, { useState
|
|
2
|
-
import {
|
|
3
|
-
import { useTheme } from 'styled-components/native'
|
|
4
|
-
import {
|
|
5
|
-
LanguageSelector as LanguageSelectorController,
|
|
6
|
-
useLanguage
|
|
7
|
-
} from 'ordering-components/native'
|
|
8
|
-
import { StyleSheet } from 'react-native'
|
|
9
|
-
import RNRestart from 'react-native-restart'
|
|
10
|
-
import Picker from 'react-native-country-picker-modal';
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { LanguageSelector as LanguageSelectorController, useOrder } from 'ordering-components/native'
|
|
3
|
+
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import { I18nManager, Platform, StyleSheet, View } from 'react-native'
|
|
11
5
|
|
|
12
|
-
import
|
|
6
|
+
import RNPickerSelect from 'react-native-picker-select'
|
|
7
|
+
import { Container, DummyContainer } from './styles'
|
|
13
8
|
import { LanguageSelectorParams } from '../../types'
|
|
14
|
-
import {
|
|
9
|
+
import { OIcon } from '../shared'
|
|
10
|
+
import RNRestart from 'react-native-restart'
|
|
15
11
|
|
|
16
12
|
const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
13
|
+
|
|
17
14
|
const {
|
|
18
15
|
languagesState,
|
|
19
16
|
currentLanguage,
|
|
20
17
|
handleChangeLanguage,
|
|
21
|
-
|
|
18
|
+
pickerStyle
|
|
22
19
|
} = props
|
|
23
20
|
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
27
|
-
const [optionSelected, setOptionSelected] = useState<any>(null)
|
|
28
|
-
let current;
|
|
21
|
+
const [orderState] = useOrder()
|
|
22
|
+
const theme = useTheme();
|
|
29
23
|
|
|
30
|
-
const
|
|
31
|
-
|
|
24
|
+
const [language, setLanguage] = useState(currentLanguage)
|
|
25
|
+
|
|
26
|
+
const _pickerStyle = StyleSheet.create({
|
|
27
|
+
inputAndroid: {
|
|
28
|
+
color: '#000',
|
|
29
|
+
borderWidth: 1,
|
|
30
|
+
borderColor: theme.colors.clear,
|
|
31
|
+
padding: 10,
|
|
32
|
+
height: 40,
|
|
32
33
|
backgroundColor: theme.colors.disabled,
|
|
34
|
+
borderRadius: 8
|
|
33
35
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
inputIOS: {
|
|
37
|
+
color: '#000',
|
|
38
|
+
padding: 10,
|
|
36
39
|
height: 40,
|
|
40
|
+
borderWidth: 1,
|
|
41
|
+
marginStart: 20,
|
|
42
|
+
borderColor: theme.colors.clear,
|
|
43
|
+
backgroundColor: theme.colors.clear,
|
|
44
|
+
},
|
|
45
|
+
icon: {
|
|
46
|
+
width: 10,
|
|
47
|
+
marginTop: 9,
|
|
48
|
+
marginEnd: 10
|
|
49
|
+
},
|
|
50
|
+
placeholder: {
|
|
51
|
+
color: theme.colors.secundaryContrast
|
|
52
|
+
},
|
|
53
|
+
chevronDown: {
|
|
54
|
+
display: 'none'
|
|
55
|
+
},
|
|
56
|
+
chevronUp: {
|
|
57
|
+
display: 'none'
|
|
37
58
|
}
|
|
38
59
|
})
|
|
39
60
|
|
|
40
61
|
const _languages = languagesState?.languages?.map((language: any) => {
|
|
41
62
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
value: language?.code,
|
|
64
|
+
label: language?.name,
|
|
65
|
+
inputLabel: language?.name
|
|
45
66
|
}
|
|
46
67
|
})
|
|
47
68
|
_languages && _languages.sort((a: any, b: any) =>
|
|
48
|
-
(a.
|
|
69
|
+
(a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
|
|
49
70
|
)
|
|
50
71
|
|
|
51
|
-
const langSelectedObj: any = _languages && _languages.find((item: any) => item.value === currentLanguage) || {}
|
|
52
|
-
|
|
53
72
|
const changeDirection = async (language: any) => {
|
|
54
|
-
if(language !== 'ar'){
|
|
55
|
-
if (I18nManager.isRTL){
|
|
73
|
+
if (language !== 'ar') {
|
|
74
|
+
if (I18nManager.isRTL) {
|
|
56
75
|
await I18nManager.forceRTL(false)
|
|
57
76
|
RNRestart.Restart();
|
|
58
77
|
}
|
|
59
78
|
} else {
|
|
60
|
-
if(!I18nManager.isRTL){
|
|
79
|
+
if (!I18nManager.isRTL) {
|
|
61
80
|
await I18nManager.forceRTL(true)
|
|
62
81
|
RNRestart.Restart();
|
|
63
82
|
}
|
|
64
83
|
}
|
|
65
84
|
}
|
|
66
85
|
|
|
67
|
-
const handlerChangeLanguage = (langCode
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
handleChangeLanguage(langCode)
|
|
86
|
+
const handlerChangeLanguage = (langCode?: any) => {
|
|
87
|
+
changeDirection(Platform.OS === 'ios' ? language : langCode)
|
|
88
|
+
handleChangeLanguage(Platform.OS === 'ios' ? language : langCode)
|
|
71
89
|
}
|
|
72
90
|
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
if (optionSelected === languageState?.language?.code && !languageState.loading) {
|
|
75
|
-
setIsOpen(false)
|
|
76
|
-
}
|
|
77
|
-
}, [languageState])
|
|
78
|
-
|
|
79
91
|
return (
|
|
80
92
|
<Container>
|
|
81
|
-
{languagesState?.languages
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}}
|
|
93
|
-
closeButtonImageStyle={Platform.OS === 'ios' && styles.closeBtn}
|
|
94
|
-
renderFlagButton={() => (
|
|
95
|
-
<>
|
|
96
|
-
<TouchableOpacity
|
|
97
|
-
onPress={() => setIsOpen(true)}
|
|
98
|
-
disabled={_languages.length === 0 || languageState.loading}
|
|
99
|
-
>
|
|
100
|
-
<SelectItemBtn isFromProfile={isFromProfile}>
|
|
101
|
-
<OText
|
|
102
|
-
color={theme.colors.secundaryContrast}
|
|
103
|
-
size={14}
|
|
104
|
-
>
|
|
105
|
-
{langSelectedObj.key.toUpperCase()}
|
|
106
|
-
</OText>
|
|
107
|
-
</SelectItemBtn>
|
|
108
|
-
</TouchableOpacity>
|
|
109
|
-
</>
|
|
110
|
-
)}
|
|
111
|
-
flatListProps={{
|
|
112
|
-
keyExtractor: (item: any) => item.value,
|
|
113
|
-
data: _languages || [],
|
|
114
|
-
renderItem: ({ item }: any) => (
|
|
115
|
-
<TouchableOpacity
|
|
116
|
-
style={langSelectedObj.value === item.value && styles.itemSelected}
|
|
117
|
-
disabled={langSelectedObj.value === item.value || languageState.loading}
|
|
118
|
-
onPress={() => handlerChangeLanguage(item.value)}
|
|
119
|
-
>
|
|
120
|
-
<SelectItem>
|
|
121
|
-
<View style={{ width: 40 }}>
|
|
122
|
-
{optionSelected === item.value && languageState.loading && (
|
|
123
|
-
<ActivityIndicator size="small" color={theme.colors.primary} />
|
|
124
|
-
)}
|
|
125
|
-
</View>
|
|
126
|
-
<OText
|
|
127
|
-
size={14}
|
|
128
|
-
style={{ marginRight: 10 }}
|
|
129
|
-
>
|
|
130
|
-
{item.label}
|
|
131
|
-
</OText>
|
|
132
|
-
</SelectItem>
|
|
133
|
-
</TouchableOpacity>
|
|
134
|
-
),
|
|
135
|
-
}}
|
|
93
|
+
{languagesState?.languages ? (
|
|
94
|
+
<RNPickerSelect
|
|
95
|
+
onValueChange={(val) => Platform.OS === 'ios' ? setLanguage(val) : handlerChangeLanguage(val)}
|
|
96
|
+
items={_languages || []}
|
|
97
|
+
value={Platform.OS === 'ios' ? language : currentLanguage}
|
|
98
|
+
style={pickerStyle ? pickerStyle : _pickerStyle}
|
|
99
|
+
useNativeAndroidPickerStyle={false}
|
|
100
|
+
placeholder={{}}
|
|
101
|
+
disabled={orderState.loading}
|
|
102
|
+
onClose={() => Platform.OS === 'ios' ? handlerChangeLanguage() : {}}
|
|
103
|
+
onDonePress={() => handlerChangeLanguage()}
|
|
136
104
|
/>
|
|
137
|
-
)}
|
|
105
|
+
) : <DummyContainer />}
|
|
138
106
|
</Container>
|
|
139
107
|
)
|
|
140
108
|
}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import styled from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const Container = styled.View`
|
|
4
|
-
align-items: flex-end;
|
|
5
|
-
justify-content: flex-end;
|
|
6
|
-
flex-direction: row;
|
|
7
|
-
`
|
|
8
|
-
|
|
9
|
-
export const SelectItem = styled.View`
|
|
10
|
-
padding: 8px;
|
|
11
4
|
align-items: center;
|
|
5
|
+
justify-content: flex-start;
|
|
12
6
|
flex-direction: row;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
border-width: 1px;
|
|
17
|
-
border-color: transparent;
|
|
18
|
-
border-radius: 10px;
|
|
19
|
-
max-width: 140px;
|
|
20
|
-
margin-vertical: 5px;
|
|
21
|
-
padding: 15px 20px;
|
|
22
|
-
background-color: ${(props: any) => props.isFromProfile ? 'transparent' : props.theme.colors.inputDisabled};
|
|
7
|
+
`
|
|
8
|
+
export const DummyContainer = styled.View`
|
|
9
|
+
height: 40px;
|
|
23
10
|
`
|
|
@@ -6,7 +6,7 @@ import { GiftedChat, Actions, InputToolbar, Composer, Send, Bubble, MessageImage
|
|
|
6
6
|
import { USER_TYPE } from '../../config/constants'
|
|
7
7
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
8
8
|
import { OIcon, OIconButton, OText, OButton } from '../shared'
|
|
9
|
-
import { TouchableOpacity, ActivityIndicator, StyleSheet, View, Platform, Keyboard,I18nManager } from 'react-native'
|
|
9
|
+
import { TouchableOpacity, ActivityIndicator, StyleSheet, View, Platform, Keyboard, I18nManager } from 'react-native'
|
|
10
10
|
import { Header, TitleHeader, Wrapper, QuickMessageContainer } from './styles'
|
|
11
11
|
import { MessagesParams } from '../../types'
|
|
12
12
|
|
|
@@ -36,6 +36,8 @@ const ORDER_STATUS: any = {
|
|
|
36
36
|
19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
|
|
37
37
|
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
38
38
|
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
39
|
+
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
40
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
const imgOptions = {
|
|
@@ -93,7 +95,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
const handleImagePicker = () => {
|
|
96
|
-
launchImageLibrary(imgOptions, (response
|
|
98
|
+
launchImageLibrary(imgOptions, (response: any) => {
|
|
97
99
|
if (response.didCancel) {
|
|
98
100
|
// showToast(ToastType.Error, response.errorMessage);
|
|
99
101
|
} else if (response.errorMessage) {
|
|
@@ -119,10 +121,10 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
119
121
|
const messageConsole = (message: any) => {
|
|
120
122
|
return message.change?.attribute !== 'driver_id'
|
|
121
123
|
?
|
|
122
|
-
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${
|
|
123
|
-
|
|
124
|
-
`${message.change.old
|
|
125
|
-
|
|
124
|
+
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
|
|
125
|
+
`${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new || ''} ${t('MINUTES', 'Minutes')}` :
|
|
126
|
+
message.change.attribute === 'status' ? `${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
|
|
127
|
+
: `${message.change.old} ${t('TO', 'to')} ${message.change.new || t('EMPTY', 'Empty')}`
|
|
126
128
|
}`
|
|
127
129
|
: message.change.new
|
|
128
130
|
?
|
|
@@ -133,13 +135,17 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
133
135
|
|
|
134
136
|
useEffect(() => {
|
|
135
137
|
let newMessages: Array<any> = []
|
|
136
|
-
const
|
|
138
|
+
const consoleText = `${t('ORDER_PLACED_FOR', 'Order placed for')} ${parseDate(order?.created_at)} ${t('VIA', 'Via')} ${order?.app_id ? t(order?.app_id.toUpperCase(), order?.app_id) : t('OTHER', 'Other')}`
|
|
137
139
|
const firstMessage = {
|
|
138
140
|
_id: 0,
|
|
139
|
-
text:
|
|
141
|
+
text: consoleText,
|
|
140
142
|
createdAt: order?.created_at,
|
|
141
|
-
system: true
|
|
143
|
+
system: true,
|
|
144
|
+
user: {
|
|
145
|
+
_id: 0
|
|
146
|
+
}
|
|
142
147
|
}
|
|
148
|
+
|
|
143
149
|
messages.messages.map((message: any) => {
|
|
144
150
|
let newMessage
|
|
145
151
|
if (message.type !== 0 && (messagesToShow?.messages?.length || (message?.can_see?.includes('2')) || (message?.can_see?.includes('4') && type === USER_TYPE.DRIVER))) {
|
|
@@ -159,7 +165,9 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
159
165
|
if (message.type === 0) {
|
|
160
166
|
newMessage = firstMessage
|
|
161
167
|
}
|
|
162
|
-
|
|
168
|
+
if (newMessage) {
|
|
169
|
+
newMessages = [...newMessages, newMessage]
|
|
170
|
+
}
|
|
163
171
|
})
|
|
164
172
|
setFormattedMessages([...newMessages.reverse()])
|
|
165
173
|
}, [messages.messages.length])
|
|
@@ -177,7 +185,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
177
185
|
}
|
|
178
186
|
}, [])
|
|
179
187
|
|
|
180
|
-
const RenderActions = (props
|
|
188
|
+
const RenderActions = (props: any) => {
|
|
181
189
|
return (
|
|
182
190
|
<Actions
|
|
183
191
|
{...props}
|
|
@@ -210,7 +218,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
210
218
|
)
|
|
211
219
|
}
|
|
212
220
|
|
|
213
|
-
const renderInputToolbar = (props
|
|
221
|
+
const renderInputToolbar = (props: any) => (
|
|
214
222
|
<InputToolbar
|
|
215
223
|
{...props}
|
|
216
224
|
containerStyle={{
|
|
@@ -271,7 +279,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
271
279
|
<OText size={14}>{t('NOT_SEND_MESSAGES', 'You can\'t send messages because the order has ended')}</OText>
|
|
272
280
|
</View>
|
|
273
281
|
) : (
|
|
274
|
-
<View style={{flexDirection: 'row', width: '80%'}}>
|
|
282
|
+
<View style={{ flexDirection: 'row', width: '80%' }}>
|
|
275
283
|
<Composer
|
|
276
284
|
{...props}
|
|
277
285
|
textInputStyle={{
|
|
@@ -308,20 +316,20 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
308
316
|
alwaysShowSend
|
|
309
317
|
containerStyle={styles.containerSend}
|
|
310
318
|
>
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
319
|
+
<OIconButton
|
|
320
|
+
onClick={onSubmit}
|
|
321
|
+
style={{
|
|
322
|
+
height: 32,
|
|
323
|
+
borderRadius: 25,
|
|
324
|
+
opacity: (sendMessage?.loading || (message === '' && !image) || messages?.loading) ? 0.4 : 1,
|
|
325
|
+
borderColor: theme.colors.primary,
|
|
326
|
+
}}
|
|
327
|
+
iconStyle={{ marginTop: 3, marginRight: 2 }}
|
|
328
|
+
icon={!sendMessage?.loading ? paperIcon : undefined}
|
|
329
|
+
RenderIcon={sendMessage?.loading ? () => <ActivityIndicator size='small' color={theme.colors.primary} /> : undefined}
|
|
330
|
+
disabled={(sendMessage?.loading || (message === '' && !image) || messages?.loading)}
|
|
331
|
+
disabledColor={theme.colors.white}
|
|
332
|
+
/>
|
|
325
333
|
</Send>
|
|
326
334
|
)
|
|
327
335
|
|
|
@@ -338,7 +346,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
338
346
|
}}
|
|
339
347
|
wrapperStyle={{
|
|
340
348
|
left: { backgroundColor: '#f7f7f7', padding: 5, borderBottomLeftRadius: 0 },
|
|
341
|
-
right: { backgroundColor: theme.colors.primary, padding: 5, borderBottomRightRadius: 0}
|
|
349
|
+
right: { backgroundColor: theme.colors.primary, padding: 5, borderBottomRightRadius: 0 }
|
|
342
350
|
}}
|
|
343
351
|
/>
|
|
344
352
|
)
|
|
@@ -357,7 +365,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
357
365
|
<>
|
|
358
366
|
<Wrapper>
|
|
359
367
|
<Header>
|
|
360
|
-
|
|
368
|
+
<OIcon
|
|
361
369
|
url={type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo}
|
|
362
370
|
width={60}
|
|
363
371
|
height={60}
|
|
@@ -415,7 +423,7 @@ const styles = StyleSheet.create({
|
|
|
415
423
|
justifyContent: 'center',
|
|
416
424
|
marginHorizontal: 4
|
|
417
425
|
},
|
|
418
|
-
editButton
|
|
426
|
+
editButton: {
|
|
419
427
|
borderRadius: 50,
|
|
420
428
|
backgroundColor: '#E9ECEF',
|
|
421
429
|
marginRight: 10,
|
|
@@ -47,6 +47,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
47
47
|
const [optionSelected, setOptionSelected] = useState({ isAsap: false, isSchedule: false })
|
|
48
48
|
const [momentState, setMomentState] = useState({ isLoading: 0, isEditing: false })
|
|
49
49
|
|
|
50
|
+
const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
|
|
51
|
+
|
|
50
52
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
51
53
|
|
|
52
54
|
const _handleAsap = () => {
|
|
@@ -192,7 +194,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
192
194
|
disabled={orderState.loading}
|
|
193
195
|
>
|
|
194
196
|
<OText color={timeSelected === hour.startTime ? theme.colors.primary : theme.colors.textSecondary}>
|
|
195
|
-
{
|
|
197
|
+
{is12hours ? (
|
|
196
198
|
hour.startTime.includes('12')
|
|
197
199
|
? `${hour.startTime}PM`
|
|
198
200
|
: parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|