ordering-ui-react-native 0.17.9 → 0.17.10-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 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +11 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/PaymentOptionsWebView/index.tsx +119 -120
- package/src/components/SingleProductReview/index.tsx +0 -24
- package/src/components/SingleProductReview/styles.tsx +0 -12
- package/src/components/StripeMethodForm/index.tsx +6 -14
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/utils/index.tsx +7 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +118 -107
- package/themes/business/src/components/DriverMap/index.tsx +22 -9
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
- package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/business/src/components/LoginForm/index.tsx +238 -80
- package/themes/business/src/components/LoginForm/styles.tsx +10 -0
- package/themes/business/src/components/MapView/index.tsx +18 -7
- package/themes/business/src/components/NewOrderNotification/index.tsx +43 -50
- package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +98 -50
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +18 -17
- package/themes/business/src/components/OrderSummary/index.tsx +113 -121
- package/themes/business/src/components/OrdersOption/index.tsx +32 -75
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
- package/themes/business/src/components/ReviewCustomer/index.tsx +41 -24
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/shared/OLink.tsx +33 -13
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/components/shared/OText.tsx +8 -2
- package/themes/business/src/types/index.tsx +33 -2
- package/themes/business/src/utils/index.tsx +51 -0
- 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/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
- package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
- package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
- 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/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
- package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
- package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
- package/themes/kiosk/src/layouts/Container.tsx +7 -1
- package/themes/kiosk/src/types/index.d.ts +13 -0
- package/themes/kiosk/src/utils/index.tsx +15 -0
- package/themes/original/index.tsx +8 -0
- package/themes/original/src/components/AddressDetails/index.tsx +29 -11
- package/themes/original/src/components/AddressForm/index.tsx +41 -16
- package/themes/original/src/components/AddressList/index.tsx +26 -21
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- package/themes/original/src/components/AnalyticsSegment/index.tsx +189 -9
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
- package/themes/original/src/components/BusinessController/index.tsx +145 -68
- package/themes/original/src/components/BusinessController/styles.tsx +22 -9
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +24 -23
- package/themes/original/src/components/BusinessListingSearch/index.tsx +52 -24
- package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
- package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +617 -492
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +98 -78
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +5 -3
- package/themes/original/src/components/Cart/index.tsx +88 -43
- package/themes/original/src/components/CartContent/index.tsx +110 -19
- package/themes/original/src/components/CartContent/styles.tsx +15 -1
- package/themes/original/src/components/Checkout/index.tsx +311 -178
- package/themes/original/src/components/Checkout/styles.tsx +4 -2
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DriverTips/index.tsx +52 -37
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +7 -4
- package/themes/original/src/components/Favorite/styles.tsx +1 -1
- package/themes/original/src/components/FavoriteList/index.tsx +51 -80
- package/themes/original/src/components/FloatingButton/index.tsx +1 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +178 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
- package/themes/original/src/components/Help/index.tsx +8 -8
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
- package/themes/original/src/components/HelpGuide/index.tsx +12 -16
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +12 -25
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +43 -19
- package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
- package/themes/original/src/components/MessageListing/index.tsx +16 -42
- package/themes/original/src/components/Messages/index.tsx +32 -10
- package/themes/original/src/components/MomentOption/index.tsx +195 -88
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +117 -96
- package/themes/original/src/components/MultiCheckout/index.tsx +248 -83
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +66 -17
- package/themes/original/src/components/NavBar/index.tsx +6 -11
- package/themes/original/src/components/Notifications/index.tsx +144 -0
- package/themes/original/src/components/Notifications/styles.tsx +20 -0
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +61 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +10 -3
- package/themes/original/src/components/OrderDetails/index.tsx +262 -347
- package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
- package/themes/original/src/components/OrderProgress/index.tsx +74 -112
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +67 -29
- package/themes/original/src/components/OrderTypeSelector/index.tsx +3 -2
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
- package/themes/original/src/components/OrdersOption/index.tsx +99 -89
- package/themes/original/src/components/PageBanner/index.tsx +171 -0
- package/themes/original/src/components/PageBanner/styles.tsx +11 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +3 -3
- package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
- package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +231 -253
- package/themes/original/src/components/ProductForm/styles.tsx +4 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +197 -138
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
- package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
- package/themes/original/src/components/Promotions/index.tsx +234 -220
- package/themes/original/src/components/Promotions/styles.tsx +10 -3
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +7 -4
- package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
- package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +377 -270
- package/themes/original/src/components/Sessions/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +82 -67
- package/themes/original/src/components/SingleOrderCard/index.tsx +148 -62
- package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -9
- package/themes/original/src/components/SingleProductCard/index.tsx +99 -55
- package/themes/original/src/components/SingleProductCard/styles.tsx +27 -13
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeCardsList/index.tsx +9 -2
- package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +8 -4
- package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
- package/themes/original/src/components/UserProfile/index.tsx +58 -35
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/original/src/components/Wallets/index.tsx +31 -17
- package/themes/original/src/components/Wallets/styles.tsx +2 -0
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +6 -2
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +10 -1
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/types/index.tsx +43 -9
- package/themes/original/src/utils/index.tsx +375 -58
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useValidationFields,
|
|
9
9
|
} from 'ordering-components/native';
|
|
10
10
|
import { useTheme } from 'styled-components/native';
|
|
11
|
-
import { CContainer, CheckoutAction,
|
|
11
|
+
import { CContainer, CheckoutAction, DriverTipsContainer } from './styles';
|
|
12
12
|
|
|
13
13
|
import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
|
|
14
14
|
|
|
@@ -41,7 +41,17 @@ const CartUI = (props: any) => {
|
|
|
41
41
|
commentState,
|
|
42
42
|
onNavigationRedirect,
|
|
43
43
|
handleRemoveOfferClick,
|
|
44
|
-
isMultiCheckout
|
|
44
|
+
isMultiCheckout,
|
|
45
|
+
hideDeliveryFee,
|
|
46
|
+
hideDriverTip,
|
|
47
|
+
hideCouponInput,
|
|
48
|
+
preorderSlotInterval,
|
|
49
|
+
preorderLeadTime,
|
|
50
|
+
preorderTimeRange,
|
|
51
|
+
preorderMaximumDays,
|
|
52
|
+
preorderMinimumDays,
|
|
53
|
+
cateringTypes,
|
|
54
|
+
isFromUpselling
|
|
45
55
|
} = props
|
|
46
56
|
|
|
47
57
|
const theme = useTheme();
|
|
@@ -61,13 +71,12 @@ const CartUI = (props: any) => {
|
|
|
61
71
|
|
|
62
72
|
const isCartPending = cart?.status === 2
|
|
63
73
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
64
|
-
const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
|
|
65
|
-
const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
|
|
66
|
-
|
|
67
74
|
const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
|
|
68
75
|
const businessId = business?.business_id ?? null
|
|
69
76
|
const placeSpotTypes = [4]
|
|
70
|
-
|
|
77
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
78
|
+
const hideCartComments = theme?.business_view?.components?.cart?.components?.comments?.hidden
|
|
79
|
+
const hideCartDiscount = theme?.business_view?.components?.cart?.components?.discount?.hidden
|
|
71
80
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
72
81
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
73
82
|
: configs?.driver_tip_options?.value || []
|
|
@@ -101,21 +110,45 @@ const CartUI = (props: any) => {
|
|
|
101
110
|
}
|
|
102
111
|
}
|
|
103
112
|
|
|
104
|
-
const handleUpsellingPage = () => {
|
|
113
|
+
const handleUpsellingPage = (individualCart : any) => {
|
|
114
|
+
const isProductCartParam = !!individualCart?.products?.length
|
|
105
115
|
setOpenUpselling(false)
|
|
106
116
|
setCanOpenUpselling(false)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
|
|
118
|
+
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
119
|
+
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
120
|
+
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
|
|
121
|
+
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
122
|
+
const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
|
|
123
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
113
124
|
screen: 'CheckoutPage',
|
|
114
125
|
cartUuid: cart?.uuid,
|
|
115
126
|
businessLogo: cart?.business?.logo,
|
|
116
127
|
businessName: cart?.business?.name,
|
|
117
128
|
cartTotal: cart?.total
|
|
129
|
+
}, true)
|
|
130
|
+
} else {
|
|
131
|
+
const groupKeys: any = {}
|
|
132
|
+
cartsAvailable.forEach((_cart: any) => {
|
|
133
|
+
groupKeys[_cart?.group?.uuid]
|
|
134
|
+
? groupKeys[_cart?.group?.uuid] += 1
|
|
135
|
+
: groupKeys[_cart?.group?.uuid ?? 'null'] = 1
|
|
118
136
|
})
|
|
137
|
+
|
|
138
|
+
if (
|
|
139
|
+
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
140
|
+
Object.keys(groupKeys).length > 1
|
|
141
|
+
) {
|
|
142
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
143
|
+
screen: 'MultiCheckout',
|
|
144
|
+
checkCarts: true
|
|
145
|
+
}, true)
|
|
146
|
+
} else {
|
|
147
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
148
|
+
screen: 'MultiCheckout',
|
|
149
|
+
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
150
|
+
}, true)
|
|
151
|
+
}
|
|
119
152
|
}
|
|
120
153
|
}
|
|
121
154
|
|
|
@@ -154,6 +187,12 @@ const CartUI = (props: any) => {
|
|
|
154
187
|
}
|
|
155
188
|
}
|
|
156
189
|
|
|
190
|
+
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
191
|
+
if (item?.type === 1)
|
|
192
|
+
return acc = acc + item?.summary?.tax
|
|
193
|
+
return acc = acc
|
|
194
|
+
}, cart?.subtotal)
|
|
195
|
+
|
|
157
196
|
return (
|
|
158
197
|
<CContainer>
|
|
159
198
|
{openUpselling && (
|
|
@@ -178,14 +217,16 @@ const CartUI = (props: any) => {
|
|
|
178
217
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
179
218
|
handleChangeStore={() => setOpenChangeStore(true)}
|
|
180
219
|
handleClickCheckout={() => setOpenUpselling(true)}
|
|
181
|
-
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) ||
|
|
220
|
+
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
182
221
|
isMultiCheckout={isMultiCheckout}
|
|
222
|
+
isFromUpselling={isFromUpselling}
|
|
183
223
|
>
|
|
184
224
|
{cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
|
|
185
225
|
<ProductItemAccordion
|
|
186
226
|
key={`${product.code}_${i}`}
|
|
187
227
|
isCartPending={isCartPending}
|
|
188
228
|
isCartProduct
|
|
229
|
+
isDisabledEdit={!cart?.business_id}
|
|
189
230
|
product={product}
|
|
190
231
|
changeQuantity={changeQuantity}
|
|
191
232
|
getProductMax={getProductMax}
|
|
@@ -291,9 +332,11 @@ const CartUI = (props: any) => {
|
|
|
291
332
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
|
|
292
333
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
293
334
|
</TouchableOpacity>
|
|
294
|
-
|
|
295
|
-
<
|
|
296
|
-
|
|
335
|
+
{!offer?.type && (
|
|
336
|
+
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
|
|
337
|
+
<AntIcon name='closecircle' size={16} color={theme.colors.primary} />
|
|
338
|
+
</TouchableOpacity>
|
|
339
|
+
)}
|
|
297
340
|
</OSRow>
|
|
298
341
|
<OText size={12} lineHeight={18}>
|
|
299
342
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -301,10 +344,10 @@ const CartUI = (props: any) => {
|
|
|
301
344
|
</OSTable>
|
|
302
345
|
))
|
|
303
346
|
}
|
|
304
|
-
{orderState?.options?.type === 1 && cart?.
|
|
347
|
+
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
305
348
|
<OSTable>
|
|
306
349
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
307
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.
|
|
350
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
308
351
|
</OSTable>
|
|
309
352
|
)}
|
|
310
353
|
{
|
|
@@ -328,7 +371,7 @@ const CartUI = (props: any) => {
|
|
|
328
371
|
</OSTable>
|
|
329
372
|
))
|
|
330
373
|
}
|
|
331
|
-
{cart?.driver_tip > 0 && (
|
|
374
|
+
{cart?.driver_tip > 0 && !hideDriverTip && (
|
|
332
375
|
<OSTable>
|
|
333
376
|
<OText size={12} lineHeight={18}>
|
|
334
377
|
{t('DRIVER_TIP', 'Driver tip')}
|
|
@@ -350,18 +393,19 @@ const CartUI = (props: any) => {
|
|
|
350
393
|
<OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
|
|
351
394
|
</OSTable>
|
|
352
395
|
))}
|
|
353
|
-
{isCouponEnabled && !isCartPending && (
|
|
396
|
+
{isCouponEnabled && !isCartPending && !hideCouponInput && (
|
|
354
397
|
<OSTable>
|
|
355
398
|
<OSCoupon>
|
|
356
399
|
<CouponControl
|
|
357
400
|
businessId={businessId}
|
|
358
401
|
price={cart.total}
|
|
402
|
+
cart={cart}
|
|
359
403
|
/>
|
|
360
404
|
</OSCoupon>
|
|
361
405
|
</OSTable>
|
|
362
406
|
)}
|
|
363
407
|
|
|
364
|
-
{isMultiCheckout &&
|
|
408
|
+
{!isMultiCheckout &&
|
|
365
409
|
cart &&
|
|
366
410
|
cart?.valid &&
|
|
367
411
|
orderState?.options?.type === 1 &&
|
|
@@ -369,30 +413,31 @@ const CartUI = (props: any) => {
|
|
|
369
413
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
370
414
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
371
415
|
(
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
416
|
+
<DriverTipsContainer>
|
|
417
|
+
<OText size={14} lineHeight={20} color={theme.colors.textNormal}>
|
|
418
|
+
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
419
|
+
</OText>
|
|
420
|
+
<DriverTips
|
|
421
|
+
uuid={cart?.uuid}
|
|
422
|
+
businessId={cart?.business_id}
|
|
423
|
+
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
424
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
425
|
+
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
426
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
427
|
+
? cart?.driver_tip
|
|
428
|
+
: cart?.driver_tip_rate}
|
|
429
|
+
useOrderContext
|
|
430
|
+
cart={cart}
|
|
431
|
+
/>
|
|
432
|
+
</DriverTipsContainer>
|
|
388
433
|
)}
|
|
389
434
|
|
|
390
435
|
<OSTotal>
|
|
391
436
|
<OSTable style={{ marginTop: 15 }}>
|
|
392
|
-
<OText size={14} lineHeight={21} weight={'
|
|
437
|
+
<OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
|
|
393
438
|
{t('TOTAL', 'Total')}
|
|
394
439
|
</OText>
|
|
395
|
-
<OText size={14} lineHeight={21} weight={'
|
|
440
|
+
<OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
|
|
396
441
|
{parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
|
|
397
442
|
</OText>
|
|
398
443
|
</OSTable>
|
|
@@ -455,15 +500,15 @@ const CartUI = (props: any) => {
|
|
|
455
500
|
{cart?.valid_products ? (
|
|
456
501
|
<CheckoutAction>
|
|
457
502
|
<OButton
|
|
458
|
-
text={(
|
|
503
|
+
text={(subtotalWithTaxes >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
|
|
459
504
|
!openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
|
|
460
505
|
) : !cart?.valid_address ? (
|
|
461
506
|
`${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
|
|
462
507
|
) : (
|
|
463
508
|
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
464
509
|
)}
|
|
465
|
-
bgColor={(
|
|
466
|
-
isDisabled={(openUpselling && !canOpenUpselling) ||
|
|
510
|
+
bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
511
|
+
isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
467
512
|
borderColor={theme.colors.primary}
|
|
468
513
|
imgRightSrc={null}
|
|
469
514
|
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { useLanguage } from 'ordering-components/native';
|
|
3
|
+
import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
|
-
import { CCContainer, CCNotCarts, CCList } from './styles';
|
|
5
|
+
import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
|
|
6
6
|
|
|
7
7
|
import { Cart } from '../Cart';
|
|
8
8
|
import { OButton, OText } from '../shared';
|
|
9
9
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
10
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
10
11
|
|
|
11
12
|
export const CartContent = (props: any) => {
|
|
12
13
|
const {
|
|
@@ -17,14 +18,61 @@ export const CartContent = (props: any) => {
|
|
|
17
18
|
|
|
18
19
|
const theme = useTheme();
|
|
19
20
|
const [, t] = useLanguage()
|
|
21
|
+
const [{ configs }] = useConfig()
|
|
22
|
+
const [{ parsePrice }] = useUtils();
|
|
20
23
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
21
24
|
|
|
25
|
+
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
26
|
+
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
27
|
+
const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
28
|
+
|
|
29
|
+
const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
|
|
30
|
+
const totalCartsFee = cartsAvailable?.length && cartsAvailable
|
|
31
|
+
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
32
|
+
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
33
|
+
|
|
34
|
+
const handleCheckoutRedirect = () => {
|
|
35
|
+
if (cartsAvailable.length === 1) {
|
|
36
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
37
|
+
screen: 'CheckoutPage',
|
|
38
|
+
cartUuid: cartsAvailable[0]?.uuid,
|
|
39
|
+
businessLogo: cartsAvailable[0]?.business?.logo,
|
|
40
|
+
businessName: cartsAvailable[0]?.business?.name,
|
|
41
|
+
cartTotal: cartsAvailable[0]?.total
|
|
42
|
+
})
|
|
43
|
+
} else {
|
|
44
|
+
const groupKeys: any = {}
|
|
45
|
+
cartsAvailable.forEach((_cart: any) => {
|
|
46
|
+
groupKeys[_cart?.group?.uuid]
|
|
47
|
+
? groupKeys[_cart?.group?.uuid] += 1
|
|
48
|
+
: groupKeys[_cart?.group?.uuid ?? 'null'] = 1
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
if (
|
|
52
|
+
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
53
|
+
Object.keys(groupKeys).length > 1
|
|
54
|
+
) {
|
|
55
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
56
|
+
screen: 'MultiCheckout',
|
|
57
|
+
checkCarts: true
|
|
58
|
+
})
|
|
59
|
+
} else {
|
|
60
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
61
|
+
screen: 'MultiCheckout',
|
|
62
|
+
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
22
68
|
return (
|
|
23
|
-
<CCContainer
|
|
69
|
+
<CCContainer
|
|
70
|
+
style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
|
|
71
|
+
>
|
|
24
72
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
25
73
|
<>
|
|
26
74
|
{carts.map((cart: any, i: number) => (
|
|
27
|
-
<CCList key={i} style={{ overflow: 'visible' }}>
|
|
75
|
+
<CCList nestedScrollEnabled={true} key={i} style={{ overflow: 'visible' }}>
|
|
28
76
|
{cart.products.length > 0 && (
|
|
29
77
|
<>
|
|
30
78
|
<Cart
|
|
@@ -35,32 +83,75 @@ export const CartContent = (props: any) => {
|
|
|
35
83
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
36
84
|
isCartsLoading={isCartsLoading}
|
|
37
85
|
setIsCartsLoading={setIsCartsLoading}
|
|
86
|
+
isMultiCheckout={isMultiCheckout}
|
|
38
87
|
hideUpselling
|
|
88
|
+
businessConfigs={cart?.business?.configs}
|
|
89
|
+
hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
|
|
90
|
+
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
91
|
+
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
39
92
|
/>
|
|
40
93
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
41
94
|
</>
|
|
42
95
|
)}
|
|
43
96
|
</CCList>
|
|
44
97
|
))}
|
|
98
|
+
{isMultiCheckout && (
|
|
99
|
+
<>
|
|
100
|
+
{!!cartsAvailable.length && (
|
|
101
|
+
<ChCartsTotal>
|
|
102
|
+
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
103
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
104
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
105
|
+
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
106
|
+
</OText>
|
|
107
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
108
|
+
{parsePrice(totalCartsFee)}
|
|
109
|
+
</OText>
|
|
110
|
+
</View>
|
|
111
|
+
)}
|
|
112
|
+
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
113
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
114
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
115
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
116
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
117
|
+
</OText>
|
|
118
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
119
|
+
{parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
120
|
+
</OText>
|
|
121
|
+
</View>
|
|
122
|
+
)}
|
|
123
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
124
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
125
|
+
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
126
|
+
</OText>
|
|
127
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
128
|
+
</View>
|
|
129
|
+
</ChCartsTotal>
|
|
130
|
+
)}
|
|
131
|
+
<CheckoutAction style={{ marginTop: 0 }}>
|
|
132
|
+
<OButton
|
|
133
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
134
|
+
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
135
|
+
isDisabled={!cartsAvailable.length}
|
|
136
|
+
borderColor={theme.colors.primary}
|
|
137
|
+
imgRightSrc={null}
|
|
138
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
139
|
+
onClick={() => handleCheckoutRedirect()}
|
|
140
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
141
|
+
/>
|
|
142
|
+
</CheckoutAction>
|
|
143
|
+
</>
|
|
144
|
+
)}
|
|
45
145
|
</>
|
|
46
146
|
)}
|
|
47
147
|
{(!carts || carts?.length === 0) && (
|
|
48
148
|
<CCNotCarts>
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
borderColor={theme.colors.primary}
|
|
56
|
-
textStyle={{
|
|
57
|
-
color: theme.colors.white,
|
|
58
|
-
fontSize: 14,
|
|
59
|
-
paddingRight: 0
|
|
60
|
-
}}
|
|
61
|
-
style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
|
|
62
|
-
imgRightSrc={null}
|
|
63
|
-
onClick={() => onNavigationRedirect('BusinessList')}
|
|
149
|
+
<NotFoundSource
|
|
150
|
+
hideImage
|
|
151
|
+
btnStyle={{ borderRadius: 8 }}
|
|
152
|
+
content={t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
153
|
+
btnTitle={t('START_SHOPPING', 'Start shopping')}
|
|
154
|
+
onClickButton={() => onNavigationRedirect('BusinessList')}
|
|
64
155
|
/>
|
|
65
156
|
</CCNotCarts>
|
|
66
157
|
)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from 'styled-components/native';
|
|
2
2
|
|
|
3
3
|
export const CCContainer = styled.View`
|
|
4
|
-
padding: 20px
|
|
4
|
+
padding-vertical: 20px;
|
|
5
5
|
`
|
|
6
6
|
|
|
7
7
|
export const CCNotCarts = styled.View`
|
|
@@ -17,3 +17,17 @@ export const CCNotCarts = styled.View`
|
|
|
17
17
|
export const CCList = styled.ScrollView`
|
|
18
18
|
padding: 10px 0px;
|
|
19
19
|
`
|
|
20
|
+
|
|
21
|
+
export const CheckoutAction = styled.View`
|
|
22
|
+
width: 100%;
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
align-items: center;
|
|
27
|
+
margin-top: 10px;
|
|
28
|
+
margin-bottom: 10px;
|
|
29
|
+
`
|
|
30
|
+
|
|
31
|
+
export const ChCartsTotal = styled.View`
|
|
32
|
+
margin-bottom: 16px;
|
|
33
|
+
`
|