ordering-ui-react-native 0.17.87 → 0.17.88-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 +8 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +5 -0
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +33 -26
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
- package/themes/business/src/components/LoginForm/index.tsx +15 -22
- package/themes/business/src/components/MapView/index.tsx +8 -8
- package/themes/business/src/components/MessagesOption/index.tsx +20 -93
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +202 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +81 -66
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +19 -18
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersOption/index.tsx +22 -22
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
- package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
- package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +25 -10
- package/themes/business/src/utils/index.tsx +29 -2
- 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/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
- 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 +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +1 -1
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +35 -17
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +73 -37
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- 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 +140 -85
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +347 -336
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
- package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +663 -556
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +38 -405
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +60 -51
- package/themes/original/src/components/CartContent/index.tsx +102 -58
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/Checkout/index.tsx +280 -35
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DriverTips/index.tsx +52 -34
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +86 -10
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/MomentOption/index.tsx +193 -92
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
- package/themes/original/src/components/MultiCheckout/index.tsx +385 -52
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +23 -19
- package/themes/original/src/components/MyOrders/index.tsx +25 -16
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
- package/themes/original/src/components/OrderDetails/index.tsx +50 -38
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderSummary/index.tsx +83 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
- package/themes/original/src/components/OrdersOption/index.tsx +59 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/index.tsx +88 -31
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
- package/themes/original/src/components/Promotions/index.tsx +2 -2
- package/themes/original/src/components/Promotions/styles.tsx +3 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +63 -20
- package/themes/original/src/components/Sessions/styles.tsx +1 -0
- package/themes/original/src/components/SignupForm/index.tsx +43 -27
- package/themes/original/src/components/SingleOrderCard/index.tsx +42 -19
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +37 -26
- package/themes/original/src/components/SingleProductCard/styles.tsx +9 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/Wallets/index.tsx +52 -62
- package/themes/original/src/components/Wallets/styles.tsx +2 -4
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/types/index.tsx +37 -10
- package/themes/original/src/utils/index.tsx +185 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -23,7 +23,7 @@ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
|
|
|
23
23
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
24
24
|
import { TaxInformation } from '../TaxInformation';
|
|
25
25
|
import { CartStoresListing } from '../CartStoresListing';
|
|
26
|
-
import { OAlert } from '
|
|
26
|
+
import { OAlert } from '../shared'
|
|
27
27
|
import { PlaceSpot } from '../PlaceSpot'
|
|
28
28
|
import { DriverTips } from '../DriverTips'
|
|
29
29
|
|
|
@@ -43,7 +43,15 @@ const CartUI = (props: any) => {
|
|
|
43
43
|
handleRemoveOfferClick,
|
|
44
44
|
isMultiCheckout,
|
|
45
45
|
hideDeliveryFee,
|
|
46
|
-
hideDriverTip
|
|
46
|
+
hideDriverTip,
|
|
47
|
+
hideCouponInput,
|
|
48
|
+
preorderSlotInterval,
|
|
49
|
+
preorderLeadTime,
|
|
50
|
+
preorderTimeRange,
|
|
51
|
+
preorderMaximumDays,
|
|
52
|
+
preorderMinimumDays,
|
|
53
|
+
cateringTypes,
|
|
54
|
+
isFromUpselling
|
|
47
55
|
} = props
|
|
48
56
|
|
|
49
57
|
const theme = useTheme();
|
|
@@ -58,7 +66,6 @@ const CartUI = (props: any) => {
|
|
|
58
66
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
59
67
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
60
68
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
61
|
-
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
62
69
|
const [openPlaceModal, setOpenPlaceModal] = useState(false)
|
|
63
70
|
|
|
64
71
|
const isCartPending = cart?.status === 2
|
|
@@ -101,18 +108,23 @@ const CartUI = (props: any) => {
|
|
|
101
108
|
}
|
|
102
109
|
}
|
|
103
110
|
|
|
104
|
-
const handleUpsellingPage = () => {
|
|
111
|
+
const handleUpsellingPage = (individualCart : any) => {
|
|
112
|
+
const isProductCartParam = !!individualCart?.products?.length
|
|
105
113
|
setOpenUpselling(false)
|
|
106
114
|
setCanOpenUpselling(false)
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
|
|
116
|
+
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
117
|
+
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
118
|
+
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
|
|
119
|
+
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
120
|
+
const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
|
|
109
121
|
onNavigationRedirect('CheckoutNavigator', {
|
|
110
122
|
screen: 'CheckoutPage',
|
|
111
|
-
cartUuid:
|
|
112
|
-
businessLogo:
|
|
113
|
-
businessName:
|
|
114
|
-
cartTotal:
|
|
115
|
-
})
|
|
123
|
+
cartUuid: cart?.uuid,
|
|
124
|
+
businessLogo: cart?.business?.logo,
|
|
125
|
+
businessName: cart?.business?.name,
|
|
126
|
+
cartTotal: cart?.total
|
|
127
|
+
}, true)
|
|
116
128
|
} else {
|
|
117
129
|
const groupKeys: any = {}
|
|
118
130
|
cartsAvailable.forEach((_cart: any) => {
|
|
@@ -125,12 +137,15 @@ const CartUI = (props: any) => {
|
|
|
125
137
|
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
126
138
|
Object.keys(groupKeys).length > 1
|
|
127
139
|
) {
|
|
128
|
-
onNavigationRedirect('CheckoutNavigator', {
|
|
140
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
141
|
+
screen: 'MultiCheckout',
|
|
142
|
+
checkCarts: true
|
|
143
|
+
}, true)
|
|
129
144
|
} else {
|
|
130
145
|
onNavigationRedirect('CheckoutNavigator', {
|
|
131
146
|
screen: 'MultiCheckout',
|
|
132
147
|
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
133
|
-
})
|
|
148
|
+
}, true)
|
|
134
149
|
}
|
|
135
150
|
}
|
|
136
151
|
}
|
|
@@ -149,16 +164,16 @@ const CartUI = (props: any) => {
|
|
|
149
164
|
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
150
165
|
}
|
|
151
166
|
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
167
|
+
const OfferAlert = ({ offerId }: any) => {
|
|
168
|
+
return (
|
|
169
|
+
<OAlert
|
|
170
|
+
title={t('OFFER', 'Offer')}
|
|
171
|
+
message={t('QUESTION_DELETE_OFFER', 'Are you sure that you want to delete the offer?')}
|
|
172
|
+
onAccept={() => handleRemoveOfferClick(offerId)}
|
|
173
|
+
>
|
|
174
|
+
<AntIcon style={{ marginLeft: 3 }} name='closecircle' size={16} color={theme.colors.primary} />
|
|
175
|
+
</OAlert>
|
|
176
|
+
)
|
|
162
177
|
}
|
|
163
178
|
|
|
164
179
|
const walletName: any = {
|
|
@@ -202,6 +217,7 @@ const CartUI = (props: any) => {
|
|
|
202
217
|
handleClickCheckout={() => setOpenUpselling(true)}
|
|
203
218
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
204
219
|
isMultiCheckout={isMultiCheckout}
|
|
220
|
+
isFromUpselling={isFromUpselling}
|
|
205
221
|
>
|
|
206
222
|
{cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
|
|
207
223
|
<ProductItemAccordion
|
|
@@ -215,7 +231,6 @@ const CartUI = (props: any) => {
|
|
|
215
231
|
offsetDisabled={offsetDisabled}
|
|
216
232
|
onDeleteProduct={handleDeleteClick}
|
|
217
233
|
onEditProduct={handleEditProduct}
|
|
218
|
-
viewString='business_view'
|
|
219
234
|
/>
|
|
220
235
|
))}
|
|
221
236
|
|
|
@@ -227,7 +242,7 @@ const CartUI = (props: any) => {
|
|
|
227
242
|
{parsePrice(cart?.subtotal + getIncludedTaxes())}
|
|
228
243
|
</OText>
|
|
229
244
|
</OSTable>
|
|
230
|
-
{
|
|
245
|
+
{cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && (
|
|
231
246
|
<OSTable>
|
|
232
247
|
{cart?.discount_type === 1 ? (
|
|
233
248
|
<OText size={12} lineHeight={18}>
|
|
@@ -241,7 +256,7 @@ const CartUI = (props: any) => {
|
|
|
241
256
|
</OSTable>
|
|
242
257
|
)}
|
|
243
258
|
{
|
|
244
|
-
|
|
259
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
|
|
245
260
|
<OSTable key={`${offer.id}_${i}`}>
|
|
246
261
|
<OSRow>
|
|
247
262
|
<OText size={12} lineHeight={18}>{offer.name}</OText>
|
|
@@ -251,9 +266,9 @@ const CartUI = (props: any) => {
|
|
|
251
266
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
|
|
252
267
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
253
268
|
</TouchableOpacity>
|
|
254
|
-
|
|
255
|
-
<
|
|
256
|
-
|
|
269
|
+
{!!offer?.id && (
|
|
270
|
+
<OfferAlert offerId={offer?.id} />
|
|
271
|
+
)}
|
|
257
272
|
</OSRow>
|
|
258
273
|
<OText size={12} lineHeight={18}>
|
|
259
274
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -262,7 +277,7 @@ const CartUI = (props: any) => {
|
|
|
262
277
|
))
|
|
263
278
|
}
|
|
264
279
|
{/* <Divider /> */}
|
|
265
|
-
{
|
|
280
|
+
{cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
|
|
266
281
|
<OSTable>
|
|
267
282
|
<OText size={12} lineHeight={18} numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
268
283
|
{cart?.business?.tax_type === 1 ? (
|
|
@@ -315,9 +330,9 @@ const CartUI = (props: any) => {
|
|
|
315
330
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
|
|
316
331
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
317
332
|
</TouchableOpacity>
|
|
318
|
-
|
|
319
|
-
<
|
|
320
|
-
|
|
333
|
+
{!!offer?.id && (
|
|
334
|
+
<OfferAlert offerId={offer?.id} />
|
|
335
|
+
)}
|
|
321
336
|
</OSRow>
|
|
322
337
|
<OText size={12} lineHeight={18}>
|
|
323
338
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -325,10 +340,10 @@ const CartUI = (props: any) => {
|
|
|
325
340
|
</OSTable>
|
|
326
341
|
))
|
|
327
342
|
}
|
|
328
|
-
{orderState?.options?.type === 1 && cart?.
|
|
343
|
+
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
329
344
|
<OSTable>
|
|
330
345
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
331
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.
|
|
346
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
332
347
|
</OSTable>
|
|
333
348
|
)}
|
|
334
349
|
{
|
|
@@ -342,9 +357,9 @@ const CartUI = (props: any) => {
|
|
|
342
357
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
|
|
343
358
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
344
359
|
</TouchableOpacity>
|
|
345
|
-
|
|
346
|
-
<
|
|
347
|
-
|
|
360
|
+
{!!offer?.id && (
|
|
361
|
+
<OfferAlert offerId={offer?.id} />
|
|
362
|
+
)}
|
|
348
363
|
</OSRow>
|
|
349
364
|
<OText size={12} lineHeight={18}>
|
|
350
365
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -374,18 +389,19 @@ const CartUI = (props: any) => {
|
|
|
374
389
|
<OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
|
|
375
390
|
</OSTable>
|
|
376
391
|
))}
|
|
377
|
-
{isCouponEnabled && !isCartPending && (
|
|
392
|
+
{isCouponEnabled && !isCartPending && !hideCouponInput && (
|
|
378
393
|
<OSTable>
|
|
379
394
|
<OSCoupon>
|
|
380
395
|
<CouponControl
|
|
381
396
|
businessId={businessId}
|
|
382
397
|
price={cart.total}
|
|
398
|
+
cart={cart}
|
|
383
399
|
/>
|
|
384
400
|
</OSCoupon>
|
|
385
401
|
</OSTable>
|
|
386
402
|
)}
|
|
387
403
|
|
|
388
|
-
{isMultiCheckout &&
|
|
404
|
+
{!isMultiCheckout &&
|
|
389
405
|
cart &&
|
|
390
406
|
cart?.valid &&
|
|
391
407
|
orderState?.options?.type === 1 &&
|
|
@@ -401,12 +417,13 @@ const CartUI = (props: any) => {
|
|
|
401
417
|
uuid={cart?.uuid}
|
|
402
418
|
businessId={cart?.business_id}
|
|
403
419
|
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
404
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
420
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
405
421
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
406
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
422
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
407
423
|
? cart?.driver_tip
|
|
408
424
|
: cart?.driver_tip_rate}
|
|
409
425
|
useOrderContext
|
|
426
|
+
cart={cart}
|
|
410
427
|
/>
|
|
411
428
|
</DriverTipsContainer>
|
|
412
429
|
)}
|
|
@@ -439,7 +456,7 @@ const CartUI = (props: any) => {
|
|
|
439
456
|
</TouchableOpacity>
|
|
440
457
|
</OSTable>
|
|
441
458
|
)}
|
|
442
|
-
{cart?.status !== 2 &&
|
|
459
|
+
{cart?.status !== 2 && (
|
|
443
460
|
<OSTable>
|
|
444
461
|
<View style={{ width: '100%', marginTop: 20 }}>
|
|
445
462
|
<OText size={16} lineHeight={18}>{t('COMMENTS', 'Comments')}</OText>
|
|
@@ -540,14 +557,6 @@ const CartUI = (props: any) => {
|
|
|
540
557
|
setOpenPlaceModal={setOpenPlaceModal}
|
|
541
558
|
/>
|
|
542
559
|
</OModal>
|
|
543
|
-
<OAlert
|
|
544
|
-
open={confirm.open}
|
|
545
|
-
title={confirm.title}
|
|
546
|
-
content={confirm.content}
|
|
547
|
-
onAccept={confirm.handleOnAccept}
|
|
548
|
-
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
549
|
-
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
550
|
-
/>
|
|
551
560
|
</CContainer>
|
|
552
561
|
)
|
|
553
562
|
}
|
|
@@ -1,58 +1,69 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { useLanguage, useConfig } 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, CheckoutAction } 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 {
|
|
13
14
|
carts,
|
|
14
15
|
isOrderStateCarts,
|
|
15
|
-
onNavigationRedirect
|
|
16
|
+
onNavigationRedirect,
|
|
17
|
+
singleBusiness
|
|
16
18
|
} = props
|
|
17
19
|
|
|
18
20
|
const theme = useTheme();
|
|
19
21
|
const [, t] = useLanguage()
|
|
20
22
|
const [{ configs }] = useConfig()
|
|
23
|
+
const [{ parsePrice }] = useUtils();
|
|
21
24
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
22
25
|
|
|
23
26
|
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
24
27
|
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
25
28
|
const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
26
29
|
|
|
30
|
+
const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
|
|
31
|
+
const totalCartsFee = cartsAvailable?.length && cartsAvailable
|
|
32
|
+
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
33
|
+
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
34
|
+
|
|
27
35
|
const handleCheckoutRedirect = () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
if (cartsAvailable.length === 1) {
|
|
37
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
38
|
+
screen: 'CheckoutPage',
|
|
39
|
+
cartUuid: cartsAvailable[0]?.uuid,
|
|
40
|
+
businessLogo: cartsAvailable[0]?.business?.logo,
|
|
41
|
+
businessName: cartsAvailable[0]?.business?.name,
|
|
42
|
+
cartTotal: cartsAvailable[0]?.total
|
|
43
|
+
})
|
|
44
|
+
} else {
|
|
45
|
+
const groupKeys: any = {}
|
|
46
|
+
cartsAvailable.forEach((_cart: any) => {
|
|
47
|
+
groupKeys[_cart?.group?.uuid]
|
|
48
|
+
? groupKeys[_cart?.group?.uuid] += 1
|
|
49
|
+
: groupKeys[_cart?.group?.uuid ?? 'null'] = 1
|
|
50
|
+
})
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
if (
|
|
53
|
+
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
54
|
+
Object.keys(groupKeys).length > 1
|
|
55
|
+
) {
|
|
56
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
57
|
+
screen: 'MultiCheckout',
|
|
58
|
+
checkCarts: true
|
|
59
|
+
})
|
|
60
|
+
} else {
|
|
61
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
62
|
+
screen: 'MultiCheckout',
|
|
63
|
+
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
}
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
return (
|
|
@@ -62,7 +73,7 @@ export const CartContent = (props: any) => {
|
|
|
62
73
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
63
74
|
<>
|
|
64
75
|
{carts.map((cart: any, i: number) => (
|
|
65
|
-
<CCList key={i} style={{ overflow: 'visible' }}>
|
|
76
|
+
<CCList nestedScrollEnabled={true} key={i} style={{ overflow: 'visible' }}>
|
|
66
77
|
{cart.products.length > 0 && (
|
|
67
78
|
<>
|
|
68
79
|
<Cart
|
|
@@ -75,6 +86,10 @@ export const CartContent = (props: any) => {
|
|
|
75
86
|
setIsCartsLoading={setIsCartsLoading}
|
|
76
87
|
isMultiCheckout={isMultiCheckout}
|
|
77
88
|
hideUpselling
|
|
89
|
+
businessConfigs={cart?.business?.configs}
|
|
90
|
+
hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
|
|
91
|
+
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
92
|
+
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
78
93
|
/>
|
|
79
94
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
80
95
|
</>
|
|
@@ -82,38 +97,67 @@ export const CartContent = (props: any) => {
|
|
|
82
97
|
</CCList>
|
|
83
98
|
))}
|
|
84
99
|
{isMultiCheckout && (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
<>
|
|
101
|
+
{!!cartsAvailable.length && (
|
|
102
|
+
<ChCartsTotal>
|
|
103
|
+
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
104
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
105
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
106
|
+
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
107
|
+
</OText>
|
|
108
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
109
|
+
{parsePrice(totalCartsFee)}
|
|
110
|
+
</OText>
|
|
111
|
+
</View>
|
|
112
|
+
)}
|
|
113
|
+
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
114
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
115
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
116
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
117
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
118
|
+
</OText>
|
|
119
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
120
|
+
{parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
121
|
+
</OText>
|
|
122
|
+
</View>
|
|
123
|
+
)}
|
|
124
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
125
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
126
|
+
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
127
|
+
</OText>
|
|
128
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
129
|
+
</View>
|
|
130
|
+
<View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
|
|
131
|
+
<OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
|
|
132
|
+
{t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
|
|
133
|
+
</OText>
|
|
134
|
+
</View>
|
|
135
|
+
</ChCartsTotal>
|
|
136
|
+
)}
|
|
137
|
+
<CheckoutAction style={{ marginTop: 0 }}>
|
|
138
|
+
<OButton
|
|
139
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
140
|
+
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
141
|
+
isDisabled={!cartsAvailable.length}
|
|
142
|
+
borderColor={theme.colors.primary}
|
|
143
|
+
imgRightSrc={null}
|
|
144
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
145
|
+
onClick={() => handleCheckoutRedirect()}
|
|
146
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
147
|
+
/>
|
|
148
|
+
</CheckoutAction>
|
|
149
|
+
</>
|
|
97
150
|
)}
|
|
98
151
|
</>
|
|
99
152
|
)}
|
|
100
153
|
{(!carts || carts?.length === 0) && (
|
|
101
154
|
<CCNotCarts>
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
borderColor={theme.colors.primary}
|
|
109
|
-
textStyle={{
|
|
110
|
-
color: theme.colors.white,
|
|
111
|
-
fontSize: 14,
|
|
112
|
-
paddingRight: 0
|
|
113
|
-
}}
|
|
114
|
-
style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
|
|
115
|
-
imgRightSrc={null}
|
|
116
|
-
onClick={() => onNavigationRedirect('BusinessList')}
|
|
155
|
+
<NotFoundSource
|
|
156
|
+
hideImage
|
|
157
|
+
btnStyle={{ borderRadius: 8 }}
|
|
158
|
+
content={t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
159
|
+
btnTitle={t('START_SHOPPING', 'Start shopping')}
|
|
160
|
+
onClickButton={() => singleBusiness ? onNavigationRedirect('Business') : onNavigationRedirect('BusinessList')}
|
|
117
161
|
/>
|
|
118
162
|
</CCNotCarts>
|
|
119
163
|
)}
|
|
@@ -5,13 +5,9 @@ export const CCContainer = styled.View`
|
|
|
5
5
|
`
|
|
6
6
|
|
|
7
7
|
export const CCNotCarts = styled.View`
|
|
8
|
-
height: 300px;
|
|
9
|
-
display: flex;
|
|
10
8
|
flex-direction: column;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
width: 80%;
|
|
14
|
-
margin: auto;
|
|
9
|
+
align-items: center;
|
|
10
|
+
margin-top: 40px;
|
|
15
11
|
`
|
|
16
12
|
|
|
17
13
|
export const CCList = styled.ScrollView`
|
|
@@ -27,3 +23,7 @@ export const CheckoutAction = styled.View`
|
|
|
27
23
|
margin-top: 10px;
|
|
28
24
|
margin-bottom: 10px;
|
|
29
25
|
`
|
|
26
|
+
|
|
27
|
+
export const ChCartsTotal = styled.View`
|
|
28
|
+
margin-bottom: 16px;
|
|
29
|
+
`
|