ordering-ui-react-native 0.21.72 → 0.21.74
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 +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +23 -7
- package/themes/business/src/components/OrdersOption/index.tsx +41 -6
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +3 -3
- package/themes/business/src/components/UserProfileForm/index.tsx +20 -4
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/original/src/components/Checkout/index.tsx +17 -2
- package/themes/original/src/components/OrderDetails/index.tsx +2 -3
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +7 -6
package/package.json
CHANGED
|
@@ -33,6 +33,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
33
33
|
const [state, setState] = useState({
|
|
34
34
|
selectedPrinter: { url: undefined },
|
|
35
35
|
});
|
|
36
|
+
const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
|
|
36
37
|
|
|
37
38
|
const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
|
|
38
39
|
if (name !== 'No') {
|
|
@@ -83,6 +84,24 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
83
84
|
const customerName = `${order?.customer?.name ?? ''} ${order?.customer?.middle_name ?? ''} ${order?.customer?.lastname ?? ''} ${order?.customer?.second_lastname ?? ''
|
|
84
85
|
}`?.replace(' ', ' ')?.trim() ?? ''
|
|
85
86
|
|
|
87
|
+
const walletName: any = {
|
|
88
|
+
cash: {
|
|
89
|
+
name: t('CASH_WALLET', 'Cash Wallet')
|
|
90
|
+
},
|
|
91
|
+
credit_point: {
|
|
92
|
+
name: t('POINTS_WALLET', 'Points Wallet')
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const handlePaymethodsListString = () => {
|
|
97
|
+
const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
|
|
98
|
+
return paymethod?.wallet_event
|
|
99
|
+
? walletName[paymethod?.wallet_event?.wallet?.type]?.name
|
|
100
|
+
: t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
|
|
101
|
+
})
|
|
102
|
+
return paymethodsList.join(', ')
|
|
103
|
+
}
|
|
104
|
+
|
|
86
105
|
const orderSummary = () => {
|
|
87
106
|
return `
|
|
88
107
|
<div>
|
|
@@ -99,7 +118,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
99
118
|
: parseDate(order?.delivery_datetime, { utc: false })
|
|
100
119
|
}
|
|
101
120
|
</br>
|
|
102
|
-
${
|
|
121
|
+
${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}: ${handlePaymethodsListString()}
|
|
103
122
|
</p>
|
|
104
123
|
|
|
105
124
|
<h1>${t('CUSTOMER_DETAILS', 'Customer details')}</h1>
|
|
@@ -114,8 +133,8 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
114
133
|
} </br>`
|
|
115
134
|
: ''
|
|
116
135
|
}
|
|
117
|
-
${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}
|
|
118
|
-
</br>
|
|
136
|
+
${t('FULL_ADDRESS', 'Full Addres')}: ${order?.customer?.address}
|
|
137
|
+
</br>
|
|
119
138
|
${!!order?.customer?.internal_number
|
|
120
139
|
? `${t('INTERNAL_NUMBER', 'Internal Number')}: ${order?.customer?.internal_number
|
|
121
140
|
} </br>`
|
|
@@ -379,10 +398,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
|
|
|
379
398
|
}`}
|
|
380
399
|
</OText>
|
|
381
400
|
|
|
382
|
-
<OText style={{ marginBottom: 5 }}>{`${t('PAYMENT_METHOD')}: ${
|
|
383
|
-
order?.paymethod?.name.toUpperCase(),
|
|
384
|
-
order?.paymethod?.name,
|
|
385
|
-
)}`}</OText>
|
|
401
|
+
<OText style={{ marginBottom: 5 }}>{`${t(`${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${handlePaymethodsListString()}`}</OText>
|
|
386
402
|
</OrderHeader>
|
|
387
403
|
|
|
388
404
|
<OrderCustomer>
|
|
@@ -389,6 +389,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
389
389
|
<View style={styles.header}>
|
|
390
390
|
<OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
|
|
391
391
|
<IconWrapper>
|
|
392
|
+
<View style={{ marginRight: 10 }}>
|
|
393
|
+
<WebsocketStatus />
|
|
394
|
+
</View>
|
|
392
395
|
<FeatherIcon
|
|
393
396
|
name='refresh-cw'
|
|
394
397
|
color={theme.colors.backgroundDark}
|
|
@@ -404,10 +407,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
404
407
|
/>
|
|
405
408
|
</IconWrapper>
|
|
406
409
|
</View>
|
|
407
|
-
<WebsocketStatus />
|
|
408
410
|
{configState?.configs?.order_deadlines_enabled?.value === '1' && (
|
|
409
411
|
<View style={styles.SLAwrapper}>
|
|
410
|
-
<View style={{ flex: 0.5 }}>
|
|
412
|
+
{/* <View style={{ flex: 0.5 }}>
|
|
411
413
|
<OButton
|
|
412
414
|
text={t('SLA_SETTING', 'SLA’s Settings')}
|
|
413
415
|
textStyle={{ color: theme.colors.backArrow }}
|
|
@@ -421,9 +423,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
421
423
|
}}
|
|
422
424
|
onClick={onClickSetting}
|
|
423
425
|
/>
|
|
424
|
-
</View>
|
|
425
|
-
<View style={{ width: 10, height: '100%' }} />
|
|
426
|
-
<View style={{ flex: 0.5, justifyContent: 'center' }}>
|
|
426
|
+
</View> */}
|
|
427
|
+
{/* <View style={{ width: 10, height: '100%' }} /> */}
|
|
428
|
+
{/* <View style={{ flex: 0.5, justifyContent: 'center' }}>
|
|
427
429
|
<SelectDropdown
|
|
428
430
|
defaultButtonText={t('SLA', 'SLA\'s')}
|
|
429
431
|
data={preorderTypeList}
|
|
@@ -453,7 +455,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
453
455
|
);
|
|
454
456
|
}}
|
|
455
457
|
/>
|
|
456
|
-
</View>
|
|
458
|
+
</View> */}
|
|
457
459
|
</View>
|
|
458
460
|
)}
|
|
459
461
|
<FiltersTab>
|
|
@@ -713,6 +715,39 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
713
715
|
{openSearchModal && (
|
|
714
716
|
<SearchModalContent>
|
|
715
717
|
<ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
|
|
718
|
+
<InputContainer style={{ marginBottom: 24 }}>
|
|
719
|
+
<SelectDropdown
|
|
720
|
+
defaultButtonText={search?.timeStatus
|
|
721
|
+
? preorderTypeList.find(type => type.key === search?.timeStatus)?.name
|
|
722
|
+
: t('SLA', 'SLA\'s')}
|
|
723
|
+
data={preorderTypeList}
|
|
724
|
+
onSelect={(selectedItem, index) => {
|
|
725
|
+
setSearch({ ...search, timeStatus: selectedItem?.key })
|
|
726
|
+
}}
|
|
727
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
728
|
+
return selectedItem.name
|
|
729
|
+
}}
|
|
730
|
+
rowTextForSelection={(item, index) => {
|
|
731
|
+
return item.key
|
|
732
|
+
}}
|
|
733
|
+
buttonStyle={styles.selectOption}
|
|
734
|
+
buttonTextStyle={styles.buttonTextStyle}
|
|
735
|
+
renderDropdownIcon={isOpened => {
|
|
736
|
+
return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
|
|
737
|
+
}}
|
|
738
|
+
dropdownStyle={styles.dropdownStyle}
|
|
739
|
+
dropdownOverlayColor='transparent'
|
|
740
|
+
rowStyle={styles.rowStyle}
|
|
741
|
+
renderCustomizedRowChild={(item, index) => {
|
|
742
|
+
return (
|
|
743
|
+
<SlaOption>
|
|
744
|
+
{index !== 0 && <OrderStatus timeState={item?.key} />}
|
|
745
|
+
<View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
|
|
746
|
+
</SlaOption>
|
|
747
|
+
);
|
|
748
|
+
}}
|
|
749
|
+
/>
|
|
750
|
+
</InputContainer>
|
|
716
751
|
<InputContainer>
|
|
717
752
|
<OInput
|
|
718
753
|
value={search.id}
|
|
@@ -153,10 +153,10 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
153
153
|
<Logo style={styles.logo}>
|
|
154
154
|
<FastImage
|
|
155
155
|
style={styles.icon}
|
|
156
|
-
source={order.business?.logo ? {
|
|
157
|
-
uri:
|
|
156
|
+
source={order.business?.logo?.includes('https') ? {
|
|
157
|
+
uri: order.business?.logo,
|
|
158
158
|
priority: FastImage.priority.normal,
|
|
159
|
-
} : theme?.images?.dummies?.businessLogo}
|
|
159
|
+
} : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
|
|
160
160
|
resizeMode={FastImage.resizeMode.cover}
|
|
161
161
|
/>
|
|
162
162
|
</Logo>
|
|
@@ -46,11 +46,10 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
46
46
|
toggleIsEdit,
|
|
47
47
|
cleanFormState,
|
|
48
48
|
handleToggleAvalaibleStatusDriver,
|
|
49
|
-
userState,
|
|
50
49
|
isAlsea
|
|
51
50
|
} = props;
|
|
52
51
|
|
|
53
|
-
const [{ user }] = useSession();
|
|
52
|
+
const [{ user, sessionLoading }] = useSession();
|
|
54
53
|
const [, t] = useLanguage();
|
|
55
54
|
const [, { showToast }] = useToast();
|
|
56
55
|
const [{ optimizeImage }] = useUtils();
|
|
@@ -67,6 +66,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
67
66
|
},
|
|
68
67
|
});
|
|
69
68
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
69
|
+
const [userState, setUserState] = useState(props.userState)
|
|
70
70
|
const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
|
|
71
71
|
const [phoneToShow, setPhoneToShow] = useState('');
|
|
72
72
|
const [openModal, setOpenModal] = useState(false)
|
|
@@ -207,6 +207,22 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
207
207
|
}
|
|
208
208
|
}, [user?.country_phone_code]);
|
|
209
209
|
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
setUserState({ ...userState, ...props.userState })
|
|
212
|
+
}, [props.userState])
|
|
213
|
+
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
if (!user?.id) return
|
|
216
|
+
|
|
217
|
+
setUserState({
|
|
218
|
+
...userState,
|
|
219
|
+
result: {
|
|
220
|
+
error: true,
|
|
221
|
+
result: user
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
}, [user, props.isFocused])
|
|
225
|
+
|
|
210
226
|
const styles = StyleSheet.create({
|
|
211
227
|
label: {
|
|
212
228
|
color: theme.colors.textGray,
|
|
@@ -255,7 +271,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
255
271
|
/>
|
|
256
272
|
)}
|
|
257
273
|
|
|
258
|
-
{formState?.loading && !validationFields.error && (
|
|
274
|
+
{(formState?.loading || sessionLoading) && !validationFields.error && (
|
|
259
275
|
<View
|
|
260
276
|
style={{
|
|
261
277
|
backgroundColor: theme.colors.backgroundLight,
|
|
@@ -326,7 +342,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
326
342
|
</View>
|
|
327
343
|
)}
|
|
328
344
|
|
|
329
|
-
{!formState?.loading && !validationFields.error && (
|
|
345
|
+
{!(formState?.loading || sessionLoading) && !validationFields.error && (
|
|
330
346
|
<ScrollView showsVerticalScrollIndicator={false} style={{ flex: 1 }}>
|
|
331
347
|
<CenterView>
|
|
332
348
|
<OIcon
|
|
@@ -51,7 +51,7 @@ const SocketStatusUI = (props: any) => {
|
|
|
51
51
|
return '#E63757';
|
|
52
52
|
default:
|
|
53
53
|
return '#FF9922';
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
return (
|
|
@@ -73,7 +73,7 @@ const SocketStatusUI = (props: any) => {
|
|
|
73
73
|
<OText
|
|
74
74
|
style={{ color: theme.colors.backArrow, fontSize: 16, marginBottom: 0, lineHeight: 16 }}
|
|
75
75
|
>
|
|
76
|
-
{t('
|
|
76
|
+
{t('CONNECTION_STATUS_SHORT', 'Status')}
|
|
77
77
|
</OText>
|
|
78
78
|
<MaterialIcon
|
|
79
79
|
name='circle'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard } from 'react-native';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
4
|
import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
|
|
5
5
|
import Picker from 'react-native-country-picker-modal';
|
|
@@ -159,7 +159,7 @@ const CheckoutUI = (props: any) => {
|
|
|
159
159
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
160
160
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
161
161
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
162
|
-
const [showGateway, setShowGateway] = useState<any>({
|
|
162
|
+
const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
|
|
163
163
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
164
164
|
const [isOpen, setIsOpen] = useState(false)
|
|
165
165
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
@@ -431,6 +431,21 @@ const CheckoutUI = (props: any) => {
|
|
|
431
431
|
}
|
|
432
432
|
}, [])
|
|
433
433
|
|
|
434
|
+
useEffect(() => {
|
|
435
|
+
const onBackFunction = () => {
|
|
436
|
+
if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
|
|
437
|
+
setShowGateway({ open: false, closedByUser: true })
|
|
438
|
+
return true
|
|
439
|
+
} else {
|
|
440
|
+
return false
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
BackHandler.addEventListener('hardwareBackPress', onBackFunction)
|
|
444
|
+
return () => {
|
|
445
|
+
BackHandler.removeEventListener('hardwareBackPress', onBackFunction)
|
|
446
|
+
}
|
|
447
|
+
}, [BackHandler, webviewPaymethod?.gateway, showGateway.open])
|
|
448
|
+
|
|
434
449
|
return (
|
|
435
450
|
<>
|
|
436
451
|
<View style={styles.wrapperNavbar}>
|
|
@@ -368,7 +368,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
368
368
|
}, [order?.delivery_type])
|
|
369
369
|
|
|
370
370
|
return (
|
|
371
|
-
|
|
371
|
+
<>
|
|
372
372
|
<View style={styles.wrapperNavbar}>
|
|
373
373
|
<TopHeader>
|
|
374
374
|
<>
|
|
@@ -1125,8 +1125,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1125
1125
|
/>
|
|
1126
1126
|
</OModal>
|
|
1127
1127
|
</OrderDetailsContainer>
|
|
1128
|
-
|
|
1129
|
-
|
|
1128
|
+
</>
|
|
1130
1129
|
);
|
|
1131
1130
|
};
|
|
1132
1131
|
|
|
@@ -27,9 +27,9 @@ const StyledButton = styled.View<Props>`
|
|
|
27
27
|
padding-left: 20px;
|
|
28
28
|
padding-right: 20px;
|
|
29
29
|
position: relative;
|
|
30
|
-
${(props: any) => props?.
|
|
31
|
-
border-radius: ${props?.
|
|
32
|
-
|
|
30
|
+
${(props: any) => props?.borderRadius && css`
|
|
31
|
+
border-radius: ${typeof props?.borderRadius === 'string' ? props?.borderRadius : `${props?.borderRadius}px`};
|
|
32
|
+
`}
|
|
33
33
|
`
|
|
34
34
|
const StyledButtonDisabled = styled(StyledButton)`
|
|
35
35
|
background-color: ${(props: any) => props.theme.colors.disabled};
|
|
@@ -53,9 +53,9 @@ const Wrapper = styled.Pressable`
|
|
|
53
53
|
align-items: center;
|
|
54
54
|
justify-content: center;
|
|
55
55
|
width: 100%;
|
|
56
|
-
${(props: any) => props
|
|
57
|
-
border-radius: ${props?.
|
|
58
|
-
|
|
56
|
+
${(props: any) => props?.borderRadius && css`
|
|
57
|
+
border-radius: ${typeof props?.borderRadius === 'string' ? props?.borderRadius : `${props?.borderRadius}px`};
|
|
58
|
+
`}
|
|
59
59
|
`;
|
|
60
60
|
|
|
61
61
|
const OInput = (props: Props): React.ReactElement => {
|
|
@@ -70,6 +70,7 @@ const OInput = (props: Props): React.ReactElement => {
|
|
|
70
70
|
? props.borderColor
|
|
71
71
|
: inputFocused ? theme.colors.primary : theme.colors.border,
|
|
72
72
|
...props.style,
|
|
73
|
+
borderRadius: parseInt(theme?.general?.components?.inputs?.borderRadius) || props.style?.borderRadius
|
|
73
74
|
}}>
|
|
74
75
|
{props.icon ? (
|
|
75
76
|
<OIcon
|
|
@@ -104,9 +105,9 @@ const OInput = (props: Props): React.ReactElement => {
|
|
|
104
105
|
props.forwardRef && (props.forwardRef.current = e)
|
|
105
106
|
}}
|
|
106
107
|
style={{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
...(theme?.general?.components?.inputs?.color && {
|
|
109
|
+
color: theme?.general?.components?.inputs?.color
|
|
110
|
+
}),
|
|
110
111
|
...props?.inputStyle
|
|
111
112
|
}}
|
|
112
113
|
onFocus={() => setInputFocused(true)}
|