ordering-ui-react-native 0.15.18 → 0.15.20-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 +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/LanguageSelector/index.tsx +1 -0
- package/src/components/OrderDetails/index.tsx +26 -5
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +1 -9
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +22 -13
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -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 +54 -49
- package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
- package/themes/business/src/types/index.tsx +2 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- 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 +48 -21
- package/themes/kiosk/src/components/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- 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 +6 -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/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- 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 +174 -125
- 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 +2 -0
- package/themes/original/index.tsx +179 -0
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +52 -22
- package/themes/original/src/components/BusinessController/styles.tsx +22 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +130 -23
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +48 -57
- package/themes/original/src/components/Cart/index.tsx +18 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +42 -27
- 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 +84 -4
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/index.tsx +73 -2
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +50 -45
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +107 -111
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +25 -33
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +40 -33
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +17 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
- package/themes/original/src/components/UserProfile/index.tsx +70 -20
- package/themes/original/src/components/UserProfileForm/index.tsx +28 -24
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +75 -8
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +71 -26
- package/themes/original/src/utils/index.tsx +12 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -7,11 +7,10 @@ import {
|
|
|
7
7
|
useConfirmSetupIntent,
|
|
8
8
|
createPaymentMethod
|
|
9
9
|
} from '@stripe/stripe-react-native';
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
import { ErrorMessage } from './styles';
|
|
12
12
|
|
|
13
13
|
import { StripeElementsForm as StripeFormController } from './naked';
|
|
14
|
-
import { StripeMethodForm } from '../StripeMethodForm';
|
|
15
14
|
import { OButton, OText } from '../shared';
|
|
16
15
|
import { useTheme } from 'styled-components/native';
|
|
17
16
|
|
|
@@ -23,10 +22,6 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
23
22
|
businessId,
|
|
24
23
|
requirements,
|
|
25
24
|
stripeTokenHandler,
|
|
26
|
-
methodsPay,
|
|
27
|
-
paymethod,
|
|
28
|
-
onCancel,
|
|
29
|
-
cart
|
|
30
25
|
} = props;
|
|
31
26
|
|
|
32
27
|
const theme = useTheme();
|
|
@@ -126,49 +121,33 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
126
121
|
<View style={styles.container}>
|
|
127
122
|
{publicKey ? (
|
|
128
123
|
<View style={{ flex: 1 }}>
|
|
129
|
-
<StripeProvider
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
<CardField
|
|
144
|
-
postalCodeEnabled={true}
|
|
145
|
-
cardStyle={{
|
|
146
|
-
backgroundColor: '#FFFFFF',
|
|
147
|
-
textColor: '#000000',
|
|
148
|
-
}}
|
|
149
|
-
style={{
|
|
150
|
-
width: '100%',
|
|
151
|
-
height: 50,
|
|
152
|
-
marginVertical: 30,
|
|
153
|
-
zIndex: 9999,
|
|
154
|
-
}}
|
|
155
|
-
onCardChange={(cardDetails: any) => setCard(cardDetails)}
|
|
156
|
-
/>
|
|
157
|
-
)}
|
|
158
|
-
</StripeProvider>
|
|
159
|
-
{!methodsPay?.includes(paymethod) && (
|
|
160
|
-
<OButton
|
|
161
|
-
text={t('SAVE_CARD', 'Save card')}
|
|
162
|
-
bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
|
|
163
|
-
borderColor={isCompleted ? theme.colors.primary :theme.colors.backgroundGray}
|
|
164
|
-
style={styles.btnAddStyle}
|
|
165
|
-
textStyle={{color: 'white'}}
|
|
166
|
-
imgRightSrc={null}
|
|
167
|
-
onClick={() => handleSaveCard()}
|
|
168
|
-
isDisabled={!isCompleted}
|
|
169
|
-
isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
|
|
124
|
+
<StripeProvider publishableKey={publicKey}>
|
|
125
|
+
<CardField
|
|
126
|
+
postalCodeEnabled={true}
|
|
127
|
+
cardStyle={{
|
|
128
|
+
backgroundColor: '#FFFFFF',
|
|
129
|
+
textColor: '#000000',
|
|
130
|
+
}}
|
|
131
|
+
style={{
|
|
132
|
+
width: '100%',
|
|
133
|
+
height: 50,
|
|
134
|
+
marginVertical: 30,
|
|
135
|
+
zIndex: 9999,
|
|
136
|
+
}}
|
|
137
|
+
onCardChange={(cardDetails: any) => setCard(cardDetails)}
|
|
170
138
|
/>
|
|
171
|
-
|
|
139
|
+
</StripeProvider>
|
|
140
|
+
<OButton
|
|
141
|
+
text={t('SAVE_CARD', 'Save card')}
|
|
142
|
+
bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
|
|
143
|
+
borderColor={isCompleted ? theme.colors.primary :theme.colors.backgroundGray}
|
|
144
|
+
style={styles.btnAddStyle}
|
|
145
|
+
textStyle={{color: 'white'}}
|
|
146
|
+
imgRightSrc={null}
|
|
147
|
+
onClick={() => handleSaveCard()}
|
|
148
|
+
isDisabled={!isCompleted}
|
|
149
|
+
isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
|
|
150
|
+
/>
|
|
172
151
|
{!!errors && (
|
|
173
152
|
<ErrorMessage>
|
|
174
153
|
<OText
|
|
@@ -2,7 +2,7 @@ import styled from 'styled-components/native';
|
|
|
2
2
|
|
|
3
3
|
export const Container = styled.View`
|
|
4
4
|
width: 100%;
|
|
5
|
-
padding: 0
|
|
5
|
+
padding: 0 30px;
|
|
6
6
|
`
|
|
7
7
|
|
|
8
8
|
export const CountDownContainer = styled.View`
|
|
@@ -20,7 +20,6 @@ export const ResendSection = styled.View`
|
|
|
20
20
|
display: flex;
|
|
21
21
|
flex-direction: row;
|
|
22
22
|
justify-content: center;
|
|
23
|
-
flex-wrap: wrap;
|
|
24
23
|
`
|
|
25
24
|
|
|
26
25
|
export const WrappCountdown = styled.View`
|
package/src/config.json
CHANGED
|
@@ -20,6 +20,7 @@ import Help from '../pages/Help'
|
|
|
20
20
|
import HelpOrder from '../pages/HelpOrder'
|
|
21
21
|
import HelpGuide from '../pages/HelpGuide'
|
|
22
22
|
import HelpAccountAndPayment from '../pages/HelpAccountAndPayment'
|
|
23
|
+
import Sessions from '../pages/Sessions';
|
|
23
24
|
import Splash from '../pages/Splash';
|
|
24
25
|
import ProductDetails from '../pages/ProductDetails';
|
|
25
26
|
const Stack = createStackNavigator();
|
|
@@ -164,6 +165,11 @@ const HomeNavigator = (e : any) => {
|
|
|
164
165
|
component={HelpAccountAndPayment}
|
|
165
166
|
options={{ headerShown: false }}
|
|
166
167
|
/>
|
|
168
|
+
<Stack.Screen
|
|
169
|
+
name="Sessions"
|
|
170
|
+
component={Sessions}
|
|
171
|
+
options={{ headerShown: false }}
|
|
172
|
+
/>
|
|
167
173
|
</>
|
|
168
174
|
)}
|
|
169
175
|
</>
|
|
@@ -21,7 +21,7 @@ const BusinessesListing = (props: any) => {
|
|
|
21
21
|
...props,
|
|
22
22
|
isSearchByName: true,
|
|
23
23
|
isSearchByDescription: true,
|
|
24
|
-
propsToFetch: ['id', 'name', 'header', 'logo', 'location', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug'],
|
|
24
|
+
propsToFetch: ['id', 'name', 'header', 'logo', 'ribbon', 'location', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug'],
|
|
25
25
|
onBusinessClick: (business: any) => {
|
|
26
26
|
props.navigation.navigate('Business', { store: store || business.slug, header: business.header, logo: business.logo })
|
|
27
27
|
}
|
package/src/pages/Checkout.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import styled from 'styled-components/native';
|
|
|
7
7
|
|
|
8
8
|
import { useOrder, useLanguage, ToastType, useToast } from 'ordering-components/native';
|
|
9
9
|
|
|
10
|
-
const stripePaymentOptions = ['stripe', 'stripe_direct', 'stripe_connect'
|
|
10
|
+
const stripePaymentOptions = ['stripe', 'stripe_direct', 'stripe_connect'];
|
|
11
11
|
|
|
12
12
|
const KeyboardView = styled.KeyboardAvoidingView`
|
|
13
13
|
flex: 1;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Container } from '../../themes/original/src/layouts/Container'
|
|
3
|
+
import { Sessions as SessionsController } from '../../themes/original/src/components/Sessions'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
navigation: any;
|
|
7
|
+
route: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Sessions = (props: Props) => {
|
|
11
|
+
const sessionsProps = {
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Container>
|
|
17
|
+
<SessionsController {...sessionsProps} />
|
|
18
|
+
</Container>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default Sessions
|
package/src/types/index.tsx
CHANGED
|
@@ -287,6 +287,7 @@ export interface OrderDetailsParams {
|
|
|
287
287
|
isFromRoot?: any;
|
|
288
288
|
goToBusinessList?: any;
|
|
289
289
|
onNavigationRedirect?: any;
|
|
290
|
+
getOrder?: () => {}
|
|
290
291
|
}
|
|
291
292
|
export interface ProductItemAccordionParams {
|
|
292
293
|
key?: any;
|
|
@@ -474,12 +475,3 @@ export interface HelpGuideParams {
|
|
|
474
475
|
export interface HelpAccountAndPaymentParams {
|
|
475
476
|
navigation: any;
|
|
476
477
|
}
|
|
477
|
-
|
|
478
|
-
export interface StripeMethodFormParams {
|
|
479
|
-
cart: any;
|
|
480
|
-
handleSource: ({id, card} : {id : string, card : any}) => void;
|
|
481
|
-
onCancel: () => void;
|
|
482
|
-
setErrors: (error: string) => void;
|
|
483
|
-
paymethod: string;
|
|
484
|
-
devMode?: boolean;
|
|
485
|
-
}
|
package/src/utils/index.tsx
CHANGED
|
@@ -200,7 +200,7 @@ export const transformCountryCode = (countryCode : number) => {
|
|
|
200
200
|
*/
|
|
201
201
|
export const reviewCommentList = (type: string) => {
|
|
202
202
|
const [, t] = useLanguage()
|
|
203
|
-
|
|
203
|
+
// TODO: improve this function
|
|
204
204
|
const reviews: any = {
|
|
205
205
|
order: {
|
|
206
206
|
1: {
|
|
@@ -386,3 +386,70 @@ export const transformCountryCode = (countryCode : number) => {
|
|
|
386
386
|
|
|
387
387
|
return reviews[type]
|
|
388
388
|
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* function to manage order comment list
|
|
392
|
+
* @param {string} param0 type of orders to return
|
|
393
|
+
* @returns object with orders dictionary
|
|
394
|
+
*/
|
|
395
|
+
export const orderCommentList = (value: string) => {
|
|
396
|
+
const [, t] = useLanguage()
|
|
397
|
+
const dictionary: any = {
|
|
398
|
+
reject: 6,
|
|
399
|
+
forcePickUp: 9,
|
|
400
|
+
pickupFailed: 10,
|
|
401
|
+
forceDelivery: 11,
|
|
402
|
+
deliveryFailed: 12,
|
|
403
|
+
notReady: 14
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const status = dictionary[value]
|
|
407
|
+
|
|
408
|
+
const messages: any = {
|
|
409
|
+
6: [// on reject order
|
|
410
|
+
'Very far away',
|
|
411
|
+
'Driver/ vehicle incident',
|
|
412
|
+
'Destination unreachable',
|
|
413
|
+
'Unavailable driver',
|
|
414
|
+
'Other'
|
|
415
|
+
],
|
|
416
|
+
9: [// on force pickup status
|
|
417
|
+
'I forgot to complete it in the location',
|
|
418
|
+
'I didn\'t have internet connection',
|
|
419
|
+
'Other'
|
|
420
|
+
],
|
|
421
|
+
10: [// on pickup failed by driver
|
|
422
|
+
'Very far away',
|
|
423
|
+
'Driver/ vehicle incident',
|
|
424
|
+
'Destination unreachable',
|
|
425
|
+
'Store closed',
|
|
426
|
+
'Unavailable driver',
|
|
427
|
+
'Other'
|
|
428
|
+
],
|
|
429
|
+
11: [// on force delivery status
|
|
430
|
+
'I forgot to complete it in the location',
|
|
431
|
+
'I didn\'t have internet connection',
|
|
432
|
+
'Other'
|
|
433
|
+
],
|
|
434
|
+
12: [// on delivery failed by driver
|
|
435
|
+
'Very far away',
|
|
436
|
+
'Driver/ vehicle incident',
|
|
437
|
+
'Destination unreachable',
|
|
438
|
+
'Recipient unavailable',
|
|
439
|
+
'Refused- incorrect/ missing items',
|
|
440
|
+
'Refused- damage',
|
|
441
|
+
'Other'
|
|
442
|
+
],
|
|
443
|
+
14: [// on order not ready
|
|
444
|
+
'Store didn\'t receive the order on time',
|
|
445
|
+
'Store very busy',
|
|
446
|
+
'Other'
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (!messages[status]) return null
|
|
451
|
+
|
|
452
|
+
const list = messages[status].map((val: any, i: number) => ({ key: i, value: val, content: t(`REJECT_REASON_${val.toUpperCase()}`, val.replace(/_/g, ' ')) }))
|
|
453
|
+
|
|
454
|
+
return { list }
|
|
455
|
+
}
|
|
@@ -16,6 +16,7 @@ import { OrderMessage } from './src/components/OrderMessage';
|
|
|
16
16
|
import { OrderDetailsBusiness } from './src/components/OrderDetails/Business';
|
|
17
17
|
import { OrderDetailsDelivery } from './src/components/OrderDetails/Delivery';
|
|
18
18
|
import { OrdersOption } from './src/components/OrdersOption';
|
|
19
|
+
import { OrdersListManager } from './src/components/OrdersListManager';
|
|
19
20
|
import { OrdersOptionStatus } from './src/components/OrdersOptionStatus';
|
|
20
21
|
import { OrdersOptionBusiness } from './src/components/OrdersOptionBusiness';
|
|
21
22
|
import { OrdersOptionCity } from './src/components/OrdersOptionCity';
|
|
@@ -84,6 +85,7 @@ export {
|
|
|
84
85
|
OrderDetailsDelivery,
|
|
85
86
|
OrderMessage,
|
|
86
87
|
OrdersOption,
|
|
88
|
+
OrdersListManager,
|
|
87
89
|
OrdersOptionStatus,
|
|
88
90
|
OrdersOptionBusiness,
|
|
89
91
|
OrdersOptionCity,
|
|
@@ -9,12 +9,14 @@ import {
|
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import { useTheme } from 'styled-components/native';
|
|
11
11
|
import { useLanguage } from 'ordering-components/native';
|
|
12
|
-
import { Content, Timer, TimeField, Header, Action, Comments } from './styles';
|
|
12
|
+
import { Content, Timer, TimeField, Header, Action, Comments, CommentsButtonGroup } from './styles';
|
|
13
13
|
import { FloatingButton } from '../FloatingButton';
|
|
14
14
|
import { OText, OButton, OTextarea, OIconButton } from '../shared';
|
|
15
15
|
import { AcceptOrRejectOrderParams } from '../../types';
|
|
16
16
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
17
17
|
|
|
18
|
+
import { orderCommentList } from '../../../../../src/utils'
|
|
19
|
+
|
|
18
20
|
export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
19
21
|
const {
|
|
20
22
|
customerCellphone,
|
|
@@ -39,15 +41,33 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
39
41
|
const [min, setMin] = useState('00');
|
|
40
42
|
const [time, setTime] = useState('');
|
|
41
43
|
const [comments, setComments] = useState('');
|
|
44
|
+
const [commentList, setCommentList] = useState<any>([]);
|
|
42
45
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
43
46
|
const { top, bottom } = useSafeAreaInsets()
|
|
44
47
|
|
|
48
|
+
const orderCommentsList = orderCommentList(action)
|
|
49
|
+
|
|
45
50
|
let codeNumberPhone, numberPhone, numberToShow;
|
|
46
51
|
const phoneNumber = customerCellphone;
|
|
47
52
|
const titleOrder = t(orderTitle[action]?.key, orderTitle[action]?.text)
|
|
48
53
|
const buttonText = t(orderTitle[action]?.btnKey, orderTitle[action]?.btnText)
|
|
49
54
|
const showTextArea = ['reject', 'deliveryFailed', 'pickupFailed', 'notReady', 'forcePickUp', 'forceDelivery'].includes(action)
|
|
50
55
|
|
|
56
|
+
const isSelectedComment = (commentKey: number) => {
|
|
57
|
+
const found = commentList.find((comment: any) => comment?.key === commentKey)
|
|
58
|
+
return found
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handleChangeComments = (commentItem: any) => {
|
|
62
|
+
const found = commentList.find((comment: any) => comment?.key === commentItem.key)
|
|
63
|
+
if (found) {
|
|
64
|
+
const _comments = commentList.filter((comment: any) => comment?.key !== commentItem.key)
|
|
65
|
+
setCommentList(_comments)
|
|
66
|
+
} else {
|
|
67
|
+
setCommentList([...commentList, commentItem])
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
51
71
|
const handleFocus = () => {
|
|
52
72
|
viewRef?.current?.measure((x: any, y: any) => {
|
|
53
73
|
scrollViewRef?.current?.scrollTo({ x: 0, y });
|
|
@@ -152,6 +172,12 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
152
172
|
const handleAcceptOrReject = () => {
|
|
153
173
|
handleFixTime();
|
|
154
174
|
|
|
175
|
+
let _comments = ''
|
|
176
|
+
if (commentList.length > 0) {
|
|
177
|
+
commentList.map((comment: any) => (_comments += comment.content + '. '))
|
|
178
|
+
}
|
|
179
|
+
const _comment = _comments + comments
|
|
180
|
+
|
|
155
181
|
let minsToSend = min;
|
|
156
182
|
|
|
157
183
|
if (min > '60') minsToSend = '59';
|
|
@@ -165,7 +191,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
165
191
|
status: 7,
|
|
166
192
|
},
|
|
167
193
|
rejectByBusiness: {
|
|
168
|
-
comment:
|
|
194
|
+
comment: _comment,
|
|
169
195
|
status: 5,
|
|
170
196
|
},
|
|
171
197
|
acceptByDriver: {
|
|
@@ -173,27 +199,27 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
173
199
|
status: 8,
|
|
174
200
|
},
|
|
175
201
|
rejectByDriver: {
|
|
176
|
-
comment:
|
|
202
|
+
comment: _comment,
|
|
177
203
|
status: 6,
|
|
178
204
|
},
|
|
179
205
|
pickupFailedByDriver: {
|
|
180
|
-
comment:
|
|
206
|
+
comment: _comment,
|
|
181
207
|
status: 10
|
|
182
208
|
},
|
|
183
209
|
deliveryFailedByDriver: {
|
|
184
|
-
comment:
|
|
210
|
+
comment: _comment,
|
|
185
211
|
status: 12
|
|
186
212
|
},
|
|
187
213
|
orderNotReady: {
|
|
188
|
-
comment:
|
|
214
|
+
comment: _comment,
|
|
189
215
|
status: 14
|
|
190
216
|
},
|
|
191
217
|
forcePickUp: {
|
|
192
|
-
reasons:
|
|
218
|
+
reasons: _comment,
|
|
193
219
|
status: 9
|
|
194
220
|
},
|
|
195
221
|
forceDelivery: {
|
|
196
|
-
reasons:
|
|
222
|
+
reasons: _comment,
|
|
197
223
|
status: 11
|
|
198
224
|
}
|
|
199
225
|
};
|
|
@@ -387,6 +413,28 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
387
413
|
onBlur={() => actions && action === 'accept' && timerRef?.current?.focus?.()}
|
|
388
414
|
/>
|
|
389
415
|
|
|
416
|
+
{orderCommentsList && (
|
|
417
|
+
<CommentsButtonGroup>
|
|
418
|
+
{orderCommentsList?.list?.map((comment: any) => (
|
|
419
|
+
<OButton
|
|
420
|
+
key={comment.key}
|
|
421
|
+
text={comment.content}
|
|
422
|
+
bgColor={isSelectedComment(comment.key) ? theme.colors.primary : theme.colors.tabBar}
|
|
423
|
+
borderColor={isSelectedComment(comment.key) ? theme.colors.primary : theme.colors.tabBar}
|
|
424
|
+
textStyle={{
|
|
425
|
+
color: isSelectedComment(comment.key) ? theme.colors.white : theme.colors.darkText,
|
|
426
|
+
fontSize: 12,
|
|
427
|
+
paddingRight: isSelectedComment(comment.key) ? 15 : 0
|
|
428
|
+
}}
|
|
429
|
+
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
430
|
+
imgRightSrc={isSelectedComment(comment.key) ? theme.images.general.close : null}
|
|
431
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
432
|
+
onClick={() => handleChangeComments(comment) }
|
|
433
|
+
/>
|
|
434
|
+
))}
|
|
435
|
+
</CommentsButtonGroup>
|
|
436
|
+
)}
|
|
437
|
+
|
|
390
438
|
{showTextArea && (
|
|
391
439
|
<Comments ref={viewRef}>
|
|
392
440
|
<OTextarea
|
|
@@ -44,6 +44,35 @@ import { USER_TYPE } from '../../config/constants';
|
|
|
44
44
|
|
|
45
45
|
import SignatureScreen from 'react-native-signature-canvas';
|
|
46
46
|
|
|
47
|
+
const ORDER_STATUS: any = {
|
|
48
|
+
0: 'ORDER_STATUS_PENDING',
|
|
49
|
+
1: 'ORDERS_COMPLETED',
|
|
50
|
+
2: 'ORDER_REJECTED',
|
|
51
|
+
3: 'ORDER_STATUS_IN_BUSINESS',
|
|
52
|
+
4: 'ORDER_READY',
|
|
53
|
+
5: 'ORDER_REJECTED_RESTAURANT',
|
|
54
|
+
6: 'ORDER_STATUS_CANCELLEDBYDRIVER',
|
|
55
|
+
7: 'ORDER_STATUS_ACCEPTEDBYRESTAURANT',
|
|
56
|
+
8: 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER',
|
|
57
|
+
9: 'ORDER_PICKUP_COMPLETED_BY_DRIVER',
|
|
58
|
+
10: 'ORDER_PICKUP_FAILED_BY_DRIVER',
|
|
59
|
+
11: 'ORDER_DELIVERY_COMPLETED_BY_DRIVER',
|
|
60
|
+
12: 'ORDER_DELIVERY_FAILED_BY_DRIVER',
|
|
61
|
+
13: 'PREORDER',
|
|
62
|
+
14: 'ORDER_NOT_READY',
|
|
63
|
+
15: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
64
|
+
16: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER',
|
|
65
|
+
17: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
66
|
+
18: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS',
|
|
67
|
+
19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
|
|
68
|
+
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
69
|
+
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
70
|
+
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
71
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const filterSpecialStatus = ['prepared_in', 'delivered_in', 'delivery_datetime']
|
|
75
|
+
|
|
47
76
|
const ChatUI = (props: MessagesParams) => {
|
|
48
77
|
const {
|
|
49
78
|
type,
|
|
@@ -317,71 +346,6 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
317
346
|
}
|
|
318
347
|
};
|
|
319
348
|
|
|
320
|
-
const getStatus = (status: number, attribute: any) => {
|
|
321
|
-
const hour = Math.trunc(status / 60);
|
|
322
|
-
const min = Math.round((status / 60 - hour) * 60);
|
|
323
|
-
|
|
324
|
-
if (attribute === 'status') {
|
|
325
|
-
switch (status) {
|
|
326
|
-
case 0:
|
|
327
|
-
return 'ORDER_STATUS_PENDING';
|
|
328
|
-
case 1:
|
|
329
|
-
return 'ORDERS_COMPLETED';
|
|
330
|
-
case 2:
|
|
331
|
-
return 'ORDER_REJECTED';
|
|
332
|
-
case 3:
|
|
333
|
-
return 'ORDER_STATUS_IN_BUSINESS';
|
|
334
|
-
case 4:
|
|
335
|
-
return 'ORDER_READY';
|
|
336
|
-
case 5:
|
|
337
|
-
return 'ORDER_REJECTED_RESTAURANT';
|
|
338
|
-
case 6:
|
|
339
|
-
return 'ORDER_STATUS_CANCELLEDBYDRIVER';
|
|
340
|
-
case 7:
|
|
341
|
-
return 'ORDER_STATUS_ACCEPTEDBYRESTAURANT';
|
|
342
|
-
case 8:
|
|
343
|
-
return 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER';
|
|
344
|
-
case 9:
|
|
345
|
-
return 'ORDER_PICKUP_COMPLETED_BY_DRIVER';
|
|
346
|
-
case 10:
|
|
347
|
-
return 'ORDER_PICKUP_FAILED_BY_DRIVER';
|
|
348
|
-
case 11:
|
|
349
|
-
return 'ORDER_DELIVERY_COMPLETED_BY_DRIVER';
|
|
350
|
-
case 12:
|
|
351
|
-
return 'ORDER_DELIVERY_FAILED_BY_DRIVER';
|
|
352
|
-
case 13:
|
|
353
|
-
return 'PREORDER';
|
|
354
|
-
case 14:
|
|
355
|
-
return 'ORDER_NOT_READY';
|
|
356
|
-
case 15:
|
|
357
|
-
return 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER';
|
|
358
|
-
case 16:
|
|
359
|
-
return 'ORDER_STATUS_CANCELLED_BY_CUSTOMER';
|
|
360
|
-
case 17:
|
|
361
|
-
return 'ORDER_NOT_PICKEDUP_BY_CUSTOMER';
|
|
362
|
-
case 18:
|
|
363
|
-
return 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS';
|
|
364
|
-
case 19:
|
|
365
|
-
return 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER';
|
|
366
|
-
case 20:
|
|
367
|
-
return 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS';
|
|
368
|
-
case 21:
|
|
369
|
-
return 'ORDER_CUSTOMER_ARRIVED_BUSINESS';
|
|
370
|
-
case 22:
|
|
371
|
-
return 'ORDER_LOOKING_FOR_DRIVER'
|
|
372
|
-
case 23:
|
|
373
|
-
return 'ORDER_DRIVER_ON_WAY'
|
|
374
|
-
default:
|
|
375
|
-
return ``;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
if (attribute === 'prepared_in' || attribute === 'delivered_in') {
|
|
380
|
-
return `${hour < 10 ? '0' + hour : hour}:${min < 10 ? '0' + min : min} ${status > 60 ? 'hours' : 'minutes'
|
|
381
|
-
}`;
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
|
|
385
349
|
const onSubmit = (values: any) => {
|
|
386
350
|
handleSend && handleSend();
|
|
387
351
|
setImage && setImage(null);
|
|
@@ -403,28 +367,16 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
403
367
|
numberOfLines={3}
|
|
404
368
|
style={{ ...styles.firstMessageText, textAlign: 'center' }}>
|
|
405
369
|
{message.change?.attribute !== 'driver_id'
|
|
406
|
-
?
|
|
407
|
-
|
|
408
|
-
message.change.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
getStatus(
|
|
412
|
-
parseInt(message.change.old, 10),
|
|
413
|
-
message.change?.attribute,
|
|
414
|
-
),
|
|
415
|
-
)
|
|
416
|
-
: '0'
|
|
417
|
-
} ${t('TO', 'to')} ${t(
|
|
418
|
-
getStatus(
|
|
419
|
-
parseInt(message.change.new, 10),
|
|
420
|
-
message.change?.attribute,
|
|
421
|
-
),
|
|
422
|
-
)}`
|
|
370
|
+
?
|
|
371
|
+
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
|
|
372
|
+
`${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
|
|
373
|
+
`${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
|
|
374
|
+
}`
|
|
423
375
|
: message.change.new
|
|
424
|
-
?
|
|
425
|
-
} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''
|
|
426
|
-
|
|
427
|
-
|
|
376
|
+
?
|
|
377
|
+
`${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
|
|
378
|
+
:
|
|
379
|
+
`${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`}
|
|
428
380
|
</OText>
|
|
429
381
|
<OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
|
|
430
382
|
{parseTime(message?.created_at, { outputFormat: 'hh:mma' })}
|