ordering-ui-react-native 0.15.9 → 0.15.12
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/src/components/MomentOption/index.tsx +3 -1
- package/src/utils/index.tsx +2 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +3 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductForm/index.tsx +0 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +3 -3
- package/themes/original/src/components/Checkout/index.tsx +24 -4
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/PaymentOptions/index.tsx +15 -6
package/package.json
CHANGED
|
@@ -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' })
|
package/src/utils/index.tsx
CHANGED
|
@@ -32,7 +32,8 @@ export const getTraduction = (key: string, t: any) => {
|
|
|
32
32
|
ERROR_PLACE_PAY_WITH_CARD1: 'An error occurred while trying to pay by card',
|
|
33
33
|
ERROR_PLACE_PAY_WITH_PAYPAL_CAPTURE: 'An error occurred while trying to pay by PayPal',
|
|
34
34
|
ERROR_ADD_PRODUCT_VERY_FAR_FOR_DELIVERY: 'Error adding product, very far for delivery',
|
|
35
|
-
ERROR_PRODUCT_NOT_FOUND: 'Error with the product'
|
|
35
|
+
ERROR_PRODUCT_NOT_FOUND: 'Error with the product',
|
|
36
|
+
ERROR_ADD_BUSINESS_INVALID: 'An error occurred with the business',
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
return keyList[key] ? t(key, keyList[key]) : t(key)
|
|
@@ -38,7 +38,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
const _categories: any = business?.
|
|
41
|
+
const _categories: any = business?.categories;
|
|
42
42
|
let _promos: any = [];
|
|
43
43
|
_categories?.forEach((categ: any) => {
|
|
44
44
|
const _featuredProds = categ?.products?.filter(
|
|
@@ -183,8 +183,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
183
183
|
resetInactivityTimeout()
|
|
184
184
|
navigation.navigate('Category', {
|
|
185
185
|
category,
|
|
186
|
-
categories: business
|
|
187
|
-
businessId: business?.
|
|
186
|
+
categories: business?.categories,
|
|
187
|
+
businessId: business?.id,
|
|
188
188
|
businessSlug: business?.slug,
|
|
189
189
|
clearInactivityTimeout,
|
|
190
190
|
resetInactivityTimeout,
|
|
@@ -212,6 +212,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
212
212
|
businessId={parseInt(businessId, 10)}
|
|
213
213
|
businessSlug={businessSlug}
|
|
214
214
|
onSave={() => {
|
|
215
|
+
showCartBottomSheet()
|
|
215
216
|
setDrawerValues({ isOpen: !drawerState.isOpen, data: null })
|
|
216
217
|
}}
|
|
217
218
|
navigation={navigation}
|
|
@@ -58,9 +58,9 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
58
58
|
const maxDistanceOptions = [1000, 2000, 5000, 'default']
|
|
59
59
|
const maxTimeOptions = [5, 15, 30, 'default']
|
|
60
60
|
const sortItems = [
|
|
61
|
-
{ text: t('PICKED_FOR_YOU', 'Picked for you (default)'), value: '
|
|
61
|
+
{ text: t('PICKED_FOR_YOU', 'Picked for you (default)'), value: 'distance' },
|
|
62
62
|
{ text: t('DELIVERY_TIME', 'Delivery time'), value: 'delivery_time' },
|
|
63
|
-
{ text: t('PICKUP_TIME', 'Pickup time'), value: '
|
|
63
|
+
{ text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
|
|
64
64
|
]
|
|
65
65
|
|
|
66
66
|
const styles = StyleSheet.create({
|
|
@@ -396,7 +396,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
396
396
|
<OText weight='bold' mBottom={7} size={16}>
|
|
397
397
|
{t('SORT', 'Sort')}
|
|
398
398
|
</OText>
|
|
399
|
-
{sortItems?.map(item => (
|
|
399
|
+
{sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
|
|
400
400
|
<TouchableOpacity
|
|
401
401
|
key={item?.value}
|
|
402
402
|
onPress={() => handleChangeFilters('orderBy', item?.value)}
|
|
@@ -39,7 +39,8 @@ import {
|
|
|
39
39
|
ChCart,
|
|
40
40
|
DeliveryOptionsContainer,
|
|
41
41
|
DeliveryOptionItem,
|
|
42
|
-
WalletPaymentOptionContainer
|
|
42
|
+
WalletPaymentOptionContainer,
|
|
43
|
+
CartHeader
|
|
43
44
|
} from './styles';
|
|
44
45
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
45
46
|
|
|
@@ -570,9 +571,28 @@ const CheckoutUI = (props: any) => {
|
|
|
570
571
|
/>
|
|
571
572
|
) : (
|
|
572
573
|
<>
|
|
573
|
-
<
|
|
574
|
-
|
|
575
|
-
|
|
574
|
+
<CartHeader>
|
|
575
|
+
<OText
|
|
576
|
+
size={16}
|
|
577
|
+
lineHeight={24}
|
|
578
|
+
color={theme.colors.textNormal}
|
|
579
|
+
style={{ fontWeight: '500' }}
|
|
580
|
+
>
|
|
581
|
+
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
582
|
+
</OText>
|
|
583
|
+
<TouchableOpacity
|
|
584
|
+
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
585
|
+
>
|
|
586
|
+
<OText
|
|
587
|
+
size={10}
|
|
588
|
+
lineHeight={15}
|
|
589
|
+
color={theme.colors.primary}
|
|
590
|
+
style={{ textDecorationLine: 'underline' }}
|
|
591
|
+
>
|
|
592
|
+
{t('ADD_PRODUCTS', 'Add products')}
|
|
593
|
+
</OText>
|
|
594
|
+
</TouchableOpacity>
|
|
595
|
+
</CartHeader>
|
|
576
596
|
{props.isFranchiseApp && (
|
|
577
597
|
<TouchableOpacity
|
|
578
598
|
onPress={() => setOpenChangeStore(true)}
|
|
@@ -105,3 +105,10 @@ export const DeliveryOptionItem = styled.View`
|
|
|
105
105
|
flex-direction: row;
|
|
106
106
|
background-color: ${(props : any) => props?.backgroundColor ?? '#fff'};
|
|
107
107
|
`;
|
|
108
|
+
|
|
109
|
+
export const CartHeader = styled.View`
|
|
110
|
+
align-items: center;
|
|
111
|
+
flex-direction: row;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
margin-bottom: 10px;
|
|
114
|
+
`
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
PaymentOptions as PaymentOptionsController,
|
|
11
11
|
useLanguage,
|
|
12
|
+
ToastType,
|
|
13
|
+
useToast,
|
|
12
14
|
} from 'ordering-components/native';
|
|
13
15
|
import { useTheme } from 'styled-components/native';
|
|
14
16
|
import { PaymentOptionCash } from '../PaymentOptionCash';
|
|
@@ -59,7 +61,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
59
61
|
} = props
|
|
60
62
|
|
|
61
63
|
const theme = useTheme();
|
|
62
|
-
|
|
64
|
+
const [, { showToast }] = useToast();
|
|
63
65
|
|
|
64
66
|
const getPayIcon = (method: string) => {
|
|
65
67
|
switch (method) {
|
|
@@ -95,11 +97,18 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
95
97
|
// ]
|
|
96
98
|
|
|
97
99
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
if (cart?.balance > 0) {
|
|
101
|
+
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
102
|
+
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
103
|
+
handlePaymentMethodClickCustom(paymethod)
|
|
104
|
+
}
|
|
105
|
+
handlePaymethodClick(paymethod, isPopupMethod)
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
showToast(
|
|
109
|
+
ToastType.Error,
|
|
110
|
+
t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
|
|
111
|
+
;
|
|
103
112
|
}
|
|
104
113
|
|
|
105
114
|
useEffect(() => {
|