ordering-ui-react-native 0.19.7-testing → 0.19.8-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 +6 -5
- 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/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +41 -13
- package/themes/business/src/components/DriverMap/index.tsx +4 -2
- package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/MapView/index.tsx +11 -7
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +138 -106
- package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -10
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +26 -6
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
- package/themes/business/src/components/OrderSummary/index.tsx +27 -13
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +83 -37
- 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 +24 -31
- 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 +192 -220
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +5 -3
- package/themes/business/src/components/UserProfileForm/index.tsx +26 -10
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/types/index.tsx +10 -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/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
- 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/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressForm/index.tsx +2 -2
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +4 -7
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +9 -6
- package/themes/original/src/components/BusinessController/styles.tsx +8 -7
- package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +43 -19
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
- package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- 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 +29 -402
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +27 -8
- package/themes/original/src/components/CartContent/index.tsx +61 -39
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +199 -55
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +1 -1
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +50 -5
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +1 -1
- 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 +53 -47
- package/themes/original/src/components/LoginForm/index.tsx +6 -1
- package/themes/original/src/components/Messages/index.tsx +9 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +4 -4
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
- package/themes/original/src/components/MultiCheckout/index.tsx +226 -52
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +19 -14
- package/themes/original/src/components/MyOrders/index.tsx +5 -5
- package/themes/original/src/components/NavBar/index.tsx +3 -1
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
- package/themes/original/src/components/OrderDetails/index.tsx +716 -667
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderProgress/index.tsx +7 -7
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +5 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +4 -3
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +3 -0
- package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
- 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 +75 -33
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +81 -167
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +4 -4
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SingleOrderCard/index.tsx +4 -3
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +23 -8
- package/themes/original/src/components/StripeElementsForm/index.tsx +5 -3
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
- package/themes/original/src/components/UserProfile/index.tsx +1 -1
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +8 -9
- package/themes/original/src/components/Wallets/styles.tsx +1 -1
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/components/shared/OModal.tsx +12 -14
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +10 -2
- package/themes/original/src/utils/index.tsx +124 -0
- 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
|
@@ -104,6 +104,8 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
104
104
|
const isOtpEmail = loginTab === 'otp' && otpType === 'email'
|
|
105
105
|
const isOtpCellphone = loginTab === 'otp' && otpType === 'cellphone'
|
|
106
106
|
|
|
107
|
+
const [isCheckingCode, setCheckingCode] = useState(false)
|
|
108
|
+
|
|
107
109
|
const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
|
|
108
110
|
const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
|
|
109
111
|
const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
|
|
@@ -179,7 +181,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
179
181
|
vibrateApp()
|
|
180
182
|
return
|
|
181
183
|
}
|
|
182
|
-
if (
|
|
184
|
+
if (otpType === 'cellphone' && phoneInputData?.error && !phoneInputData?.phone?.cellphone) {
|
|
183
185
|
showToast(ToastType.Error, t('PHONE_NUMBER_REQUIRED', 'Phone number is required'));
|
|
184
186
|
return
|
|
185
187
|
}
|
|
@@ -268,6 +270,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
268
270
|
const handleLoginOtp = async (code: string) => {
|
|
269
271
|
if (!code) return
|
|
270
272
|
const logged = await handleButtonLoginClick({ code })
|
|
273
|
+
setCheckingCode(false)
|
|
271
274
|
if (logged) {
|
|
272
275
|
setWillVerifyOtpState(false)
|
|
273
276
|
} else {
|
|
@@ -854,6 +857,8 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
854
857
|
animationType='slide'
|
|
855
858
|
>
|
|
856
859
|
<Otp
|
|
860
|
+
isCheckingCode={isCheckingCode}
|
|
861
|
+
setCheckingCode={setCheckingCode}
|
|
857
862
|
willVerifyOtpState={willVerifyOtpState}
|
|
858
863
|
otpError={otpError}
|
|
859
864
|
setOtpError={setOtpError}
|
|
@@ -126,9 +126,13 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
126
126
|
const messageConsole = (message: any) => {
|
|
127
127
|
return message.change?.attribute !== 'driver_id'
|
|
128
128
|
?
|
|
129
|
-
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
|
|
130
|
+
? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
|
|
131
|
+
: `${message.change?.attribute !== 'logistic_status'
|
|
132
|
+
? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
|
|
133
|
+
: message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
|
|
134
|
+
? t(ORDER_STATUS[parseInt(message.change.new, 10)])
|
|
135
|
+
: getLogisticTag(message.change.new)}`
|
|
132
136
|
}`
|
|
133
137
|
: message.change.new
|
|
134
138
|
?
|
|
@@ -148,6 +152,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
148
152
|
}
|
|
149
153
|
const newMessage: any = [];
|
|
150
154
|
messages.messages.map((message: any) => {
|
|
155
|
+
if (message.change?.attribute === 'driver_group_id') return
|
|
151
156
|
if (business && message.type !== 0 && (messagesToShow?.messages?.length || message?.can_see?.includes('2'))) {
|
|
152
157
|
newMessage.push({
|
|
153
158
|
_id: message?.id,
|
|
@@ -456,7 +461,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
456
461
|
active={business}
|
|
457
462
|
>
|
|
458
463
|
<OIcon
|
|
459
|
-
url={order?.business?.logo
|
|
464
|
+
url={order?.business?.logo}
|
|
460
465
|
width={32}
|
|
461
466
|
height={32}
|
|
462
467
|
style={{ borderRadius: 32 }}
|
|
@@ -10,7 +10,7 @@ export const Header = styled.View`
|
|
|
10
10
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
11
11
|
box-shadow: 0 2px 2px #0000001A;
|
|
12
12
|
padding-bottom: 10px;
|
|
13
|
-
padding-horizontal:
|
|
13
|
+
padding-horizontal: 10px;
|
|
14
14
|
`
|
|
15
15
|
|
|
16
16
|
export const TitleHeader = styled.View``
|
|
@@ -155,7 +155,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
155
155
|
});
|
|
156
156
|
const { bottom } = useSafeAreaInsets();
|
|
157
157
|
|
|
158
|
-
const is12hours = configs?.
|
|
158
|
+
const is12hours = configs?.general_hour_format?.value?.includes('hh:mm')
|
|
159
159
|
|
|
160
160
|
const [selectedTime, setSelectedTime] = useState(null);
|
|
161
161
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
@@ -327,8 +327,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
327
327
|
<>
|
|
328
328
|
<Container
|
|
329
329
|
style={{
|
|
330
|
-
paddingLeft: !cateringPreorder || isPage ?
|
|
331
|
-
paddingRight: !cateringPreorder || isPage ?
|
|
330
|
+
paddingLeft: !cateringPreorder || isPage ? 20 : 0,
|
|
331
|
+
paddingRight: !cateringPreorder || isPage ? 20 : 0
|
|
332
332
|
}}
|
|
333
333
|
nestedScrollEnabled
|
|
334
334
|
>
|
|
@@ -467,7 +467,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
467
467
|
<Spinner visible={momentState.isLoading === 1} />
|
|
468
468
|
</Container>
|
|
469
469
|
{!isCart && !cateringPreorder && (
|
|
470
|
-
<View style={{ position: 'absolute', bottom: bottom, paddingBottom: 20, paddingHorizontal:
|
|
470
|
+
<View style={{ position: 'absolute', bottom: bottom, paddingBottom: 20, paddingHorizontal: 20, backgroundColor: 'white', width: '100%' }}>
|
|
471
471
|
<OButton onClick={() => handleChangeMoment()} isDisabled={!selectedTime} text={t('CONTINUE', 'Continue')} style={{ borderRadius: 7.6, height: 44, shadowOpacity: 0 }} textStyle={{ color: 'white', fontSize: 14 }} showNextIcon />
|
|
472
472
|
</View>
|
|
473
473
|
)}
|
|
@@ -30,7 +30,7 @@ const MomentSelectorUI = (props: any) => {
|
|
|
30
30
|
const [customizedDateList, setCustomizedDateList] = useState([])
|
|
31
31
|
const [customizedTimeList, setCustomizedTimeList] = useState([])
|
|
32
32
|
|
|
33
|
-
const is12hours = configs?.
|
|
33
|
+
const is12hours = configs?.general_hour_format?.value?.includes('hh:mm')
|
|
34
34
|
|
|
35
35
|
const styles = StyleSheet.create({
|
|
36
36
|
selectOption: {
|
|
@@ -11,7 +11,7 @@ export const MultiCartUI = () => {
|
|
|
11
11
|
const theme = useTheme();
|
|
12
12
|
return (
|
|
13
13
|
<Container noPadding>
|
|
14
|
-
<ChContainer style={{ paddingHorizontal:
|
|
14
|
+
<ChContainer style={{ paddingHorizontal: 20 }}>
|
|
15
15
|
<ChSection>
|
|
16
16
|
<ChUserDetails>
|
|
17
17
|
<Placeholder Animation={Fade}>
|
|
@@ -47,7 +47,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
47
47
|
const [, t] = useLanguage()
|
|
48
48
|
const [{ configs }] = useConfig()
|
|
49
49
|
const [{ parsePrice }] = useUtils()
|
|
50
|
-
|
|
50
|
+
const [, { showToast }] = useToast();
|
|
51
51
|
const { confirmApplePayPayment } = useApplePay()
|
|
52
52
|
|
|
53
53
|
const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
|
|
@@ -88,6 +88,8 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
88
88
|
return theme.images.general.stripesb
|
|
89
89
|
case 'global_apple_pay':
|
|
90
90
|
return theme.images.general.applePayMark
|
|
91
|
+
case 'global_google_pay':
|
|
92
|
+
return theme.images.general.googlePayMark
|
|
91
93
|
default:
|
|
92
94
|
return theme.images.general.creditCard
|
|
93
95
|
}
|
|
@@ -123,7 +125,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
123
125
|
const renderPaymethods = ({ item }: any) => {
|
|
124
126
|
return (
|
|
125
127
|
<>
|
|
126
|
-
{item?.gateway
|
|
128
|
+
{methodsPay.includes(item?.gateway) ? (
|
|
127
129
|
<TouchableOpacity
|
|
128
130
|
onPress={() => handleChangePaymethod({ ...item, paymethod: { gateway: item.gateway }, paymethod_id: item?.id })}
|
|
129
131
|
>
|
|
@@ -214,6 +216,13 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
214
216
|
publicKey={paymethodSelected?.data?.publishable}
|
|
215
217
|
payType={paymethodSelected?.paymethod?.name}
|
|
216
218
|
onSelectCard={handlePaymethodDataChange}
|
|
219
|
+
addCardOpen={addCardOpen}
|
|
220
|
+
setAddCardOpen={setAddCardOpen}
|
|
221
|
+
openCarts={openCarts}
|
|
222
|
+
toSave
|
|
223
|
+
handlePaymethodDataChange={handlePaymethodDataChange}
|
|
224
|
+
clientSecret={props.clientSecret}
|
|
225
|
+
onPaymentChange={handlePaymethodDataChange}
|
|
217
226
|
/>
|
|
218
227
|
</View>
|
|
219
228
|
)}
|
|
@@ -297,7 +306,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
297
306
|
</>
|
|
298
307
|
)}
|
|
299
308
|
|
|
300
|
-
<OModal
|
|
309
|
+
{/* <OModal
|
|
301
310
|
entireModal
|
|
302
311
|
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
303
312
|
open={addCardOpen.stripe}
|
|
@@ -320,7 +329,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
320
329
|
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
321
330
|
/>
|
|
322
331
|
</KeyboardAvoidingView>
|
|
323
|
-
</OModal>
|
|
332
|
+
</OModal> */}
|
|
324
333
|
</PMContainer>
|
|
325
334
|
)
|
|
326
335
|
}
|
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
ToastType,
|
|
11
11
|
MultiCheckout as MultiCheckoutController
|
|
12
12
|
} from 'ordering-components/native'
|
|
13
|
-
import { View, StyleSheet, Platform } from 'react-native'
|
|
13
|
+
import { View, StyleSheet, Platform, ScrollView, SafeAreaView } from 'react-native'
|
|
14
14
|
import { useTheme } from 'styled-components/native';
|
|
15
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
15
16
|
import { Container } from '../../layouts/Container';
|
|
16
17
|
import NavBar from '../NavBar';
|
|
17
|
-
import { OText, OIcon, OModal } from '../shared';
|
|
18
|
+
import { OText, OIcon, OModal, OButton } from '../shared';
|
|
18
19
|
import { getTypesText } from '../../utils';
|
|
19
20
|
import { UserDetails } from '../UserDetails'
|
|
20
21
|
import { AddressDetails } from '../AddressDetails'
|
|
@@ -26,8 +27,12 @@ import { DriverTips } from '../DriverTips'
|
|
|
26
27
|
import { CouponControl } from '../CouponControl';
|
|
27
28
|
import { DriverTipsContainer } from '../Cart/styles'
|
|
28
29
|
import { OSTable, OSCoupon } from '../OrderSummary/styles';
|
|
30
|
+
import { SignupForm } from '../SignupForm'
|
|
31
|
+
import { LoginForm } from '../LoginForm'
|
|
29
32
|
|
|
30
33
|
import {
|
|
34
|
+
TopHeader,
|
|
35
|
+
TopActions,
|
|
31
36
|
ChContainer,
|
|
32
37
|
ChSection,
|
|
33
38
|
ChHeader,
|
|
@@ -64,16 +69,25 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
64
69
|
cartGroup,
|
|
65
70
|
walletState,
|
|
66
71
|
onNavigationRedirectReplace,
|
|
67
|
-
merchantId
|
|
72
|
+
merchantId,
|
|
73
|
+
cartsInvalid
|
|
68
74
|
} = props
|
|
69
75
|
|
|
70
76
|
const theme = useTheme();
|
|
71
77
|
const styles = StyleSheet.create({
|
|
72
78
|
pagePadding: {
|
|
73
|
-
paddingLeft:
|
|
74
|
-
paddingRight:
|
|
79
|
+
paddingLeft: 20,
|
|
80
|
+
paddingRight: 20
|
|
75
81
|
},
|
|
76
|
-
wrapperNavbar: {
|
|
82
|
+
wrapperNavbar: {
|
|
83
|
+
paddingHorizontal: 20,
|
|
84
|
+
backgroundColor: theme?.colors?.white,
|
|
85
|
+
borderWidth: 0
|
|
86
|
+
},
|
|
87
|
+
detailWrapper: {
|
|
88
|
+
paddingHorizontal: 20,
|
|
89
|
+
width: '100%'
|
|
90
|
+
},
|
|
77
91
|
})
|
|
78
92
|
|
|
79
93
|
const [, { showToast }] = useToast();
|
|
@@ -82,14 +96,14 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
82
96
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
83
97
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
84
98
|
const [validationFields] = useValidationFields();
|
|
85
|
-
const [{ user }] = useSession()
|
|
99
|
+
const [{ user }, { login }] = useSession()
|
|
86
100
|
|
|
87
101
|
const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
88
102
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
89
103
|
const isMultiDriverTips = configs?.checkout_multi_business_enabled?.value === '1'
|
|
90
104
|
const walletCarts = (Object.values(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) || []
|
|
91
105
|
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
92
|
-
|
|
106
|
+
const cartsToShow = openCarts?.length > 0 ? openCarts : cartsInvalid
|
|
93
107
|
const walletName: any = {
|
|
94
108
|
cash: {
|
|
95
109
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
@@ -129,16 +143,22 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
129
143
|
?.reduce((sum: any, cart: any) => sum + clearAmount((cart?.subtotal + getIncludedTaxes(cart)) * accumulationRateBusiness(cart?.business_id)), 0)
|
|
130
144
|
?.toFixed(configs.format_number_decimal_length?.value ?? 2)
|
|
131
145
|
|
|
146
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
132
147
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
133
148
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
134
149
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
135
150
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
151
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
152
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
153
|
+
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
154
|
+
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
155
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
136
156
|
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
137
157
|
const methodsPay = ['global_google_pay', 'global_apple_pay']
|
|
138
|
-
const isDisablePlaceOrderButton = cartGroup?.loading || (!(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) && cartGroup?.result?.balance > 0) ||
|
|
158
|
+
const isDisablePlaceOrderButton = cartGroup?.loading || placing || (!(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) && cartGroup?.result?.balance > 0) ||
|
|
139
159
|
(paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data) ||
|
|
140
160
|
walletCarts.length > 0
|
|
141
|
-
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
161
|
+
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading)) || openCarts?.length === 0
|
|
142
162
|
|
|
143
163
|
const handleMomentClick = () => {
|
|
144
164
|
if (isPreOrder) {
|
|
@@ -150,11 +170,12 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
150
170
|
setUserErrors([])
|
|
151
171
|
const errors = []
|
|
152
172
|
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
|
|
173
|
+
const _requiredFields: any = []
|
|
153
174
|
|
|
154
175
|
Object.values(validationFields?.fields?.checkout).map((field: any) => {
|
|
155
176
|
if (field?.required && !notFields.includes(field.code)) {
|
|
156
177
|
if (!user[field?.code]) {
|
|
157
|
-
|
|
178
|
+
_requiredFields.push(field?.code)
|
|
158
179
|
}
|
|
159
180
|
}
|
|
160
181
|
})
|
|
@@ -165,8 +186,9 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
165
186
|
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
166
187
|
configs?.verification_phone_required?.value === '1')
|
|
167
188
|
) {
|
|
168
|
-
|
|
189
|
+
_requiredFields.push('cellphone')
|
|
169
190
|
}
|
|
191
|
+
setRequiredFields(_requiredFields)
|
|
170
192
|
|
|
171
193
|
if (phoneUpdate) {
|
|
172
194
|
errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
|
|
@@ -179,11 +201,20 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
179
201
|
setPhoneUpdate(val)
|
|
180
202
|
}
|
|
181
203
|
|
|
182
|
-
const handlePlaceOrder = (confirmPayment
|
|
183
|
-
if (
|
|
204
|
+
const handlePlaceOrder = (confirmPayment?: any) => {
|
|
205
|
+
if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
|
|
206
|
+
setOpenModal({ ...openModal, signup: true, isGuest: true })
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest)) {
|
|
184
211
|
handleGroupPlaceOrder && handleGroupPlaceOrder(confirmPayment)
|
|
185
212
|
return
|
|
186
213
|
}
|
|
214
|
+
if (requiredFields?.length) {
|
|
215
|
+
setIsOpen(true)
|
|
216
|
+
return
|
|
217
|
+
}
|
|
187
218
|
let stringError = ''
|
|
188
219
|
Object.values(userErrors).map((item: any, i: number) => {
|
|
189
220
|
stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
|
|
@@ -192,6 +223,28 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
192
223
|
setIsUserDetailsEdit(true)
|
|
193
224
|
}
|
|
194
225
|
|
|
226
|
+
const handlePlaceOrderAsGuest = () => {
|
|
227
|
+
setIsOpen(false)
|
|
228
|
+
handleGroupPlaceOrder && handleGroupPlaceOrder()
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const handleSuccessSignup = (user: any) => {
|
|
232
|
+
login({
|
|
233
|
+
user,
|
|
234
|
+
token: user?.session?.access_token
|
|
235
|
+
})
|
|
236
|
+
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
237
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const handleSuccessLogin = (user: any) => {
|
|
241
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
245
|
+
setShowTitle(contentOffset.y > 30)
|
|
246
|
+
}
|
|
247
|
+
|
|
195
248
|
useEffect(() => {
|
|
196
249
|
if (validationFields && validationFields?.fields?.checkout) {
|
|
197
250
|
checkValidationFields()
|
|
@@ -199,14 +252,14 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
199
252
|
}, [validationFields, user])
|
|
200
253
|
|
|
201
254
|
useEffect(() => {
|
|
202
|
-
if (
|
|
255
|
+
if (cartsToShow?.length === 1) {
|
|
203
256
|
onNavigationRedirectReplace('CheckoutPage', {
|
|
204
|
-
cartUuid:
|
|
257
|
+
cartUuid: cartsToShow[0]?.uuid,
|
|
205
258
|
fromMulti: true
|
|
206
259
|
})
|
|
207
260
|
return
|
|
208
261
|
}
|
|
209
|
-
}, [
|
|
262
|
+
}, [cartsToShow])
|
|
210
263
|
|
|
211
264
|
useEffect(() => {
|
|
212
265
|
if (walletState.error) {
|
|
@@ -221,26 +274,55 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
221
274
|
}, [cartUuid])
|
|
222
275
|
|
|
223
276
|
useEffect(() => {
|
|
224
|
-
if(paymethodSelected?.gateway === 'global_google_pay'){
|
|
277
|
+
if (paymethodSelected?.gateway === 'global_google_pay') {
|
|
225
278
|
setMethodPaySupported({
|
|
226
279
|
enabled: true,
|
|
227
280
|
loading: false,
|
|
228
281
|
message: null
|
|
229
282
|
})
|
|
230
283
|
}
|
|
231
|
-
|
|
284
|
+
}, [paymethodSelected])
|
|
232
285
|
|
|
233
286
|
return (
|
|
234
287
|
<>
|
|
235
|
-
<
|
|
288
|
+
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
289
|
+
<View style={styles.wrapperNavbar}>
|
|
290
|
+
<TopHeader>
|
|
291
|
+
<>
|
|
292
|
+
<TopActions onPress={() => navigation?.canGoBack() && navigation.goBack()}>
|
|
293
|
+
<IconAntDesign
|
|
294
|
+
name='arrowleft'
|
|
295
|
+
size={26}
|
|
296
|
+
/>
|
|
297
|
+
</TopActions>
|
|
298
|
+
{showTitle && (
|
|
299
|
+
<OText
|
|
300
|
+
size={16}
|
|
301
|
+
style={{ flex: 1, textAlign: 'center', right: 15 }}
|
|
302
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
303
|
+
numberOfLines={2}
|
|
304
|
+
ellipsizeMode='tail'
|
|
305
|
+
>
|
|
306
|
+
{t('CHECKOUT', 'Checkout')}
|
|
307
|
+
</OText>
|
|
308
|
+
)}
|
|
309
|
+
</>
|
|
310
|
+
</TopHeader>
|
|
311
|
+
</View>
|
|
312
|
+
</SafeAreaView>
|
|
313
|
+
<Container pt={0} noPadding onScroll={handleScroll}>
|
|
236
314
|
<View style={styles.wrapperNavbar}>
|
|
237
315
|
<NavBar
|
|
316
|
+
hideArrowLeft
|
|
238
317
|
title={t('CHECKOUT', 'Checkout')}
|
|
239
318
|
titleAlign={'center'}
|
|
240
319
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
241
320
|
showCall={false}
|
|
242
321
|
paddingTop={Platform.OS === 'ios' ? 0 : 4}
|
|
243
322
|
btnStyle={{ paddingLeft: 0 }}
|
|
323
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
324
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
325
|
+
style={{ marginTop: 20 }}
|
|
244
326
|
/>
|
|
245
327
|
</View>
|
|
246
328
|
<ChContainer style={styles.pagePadding}>
|
|
@@ -284,15 +366,45 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
284
366
|
|
|
285
367
|
<ChSection>
|
|
286
368
|
<ChUserDetails>
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
369
|
+
{(user?.guest_id && !allowedGuest) ? (
|
|
370
|
+
<View>
|
|
371
|
+
<OText size={14} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textNormal}>
|
|
372
|
+
{t('CUSTOMER_DETAILS', 'Customer details')}
|
|
373
|
+
</OText>
|
|
374
|
+
<OButton
|
|
375
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
376
|
+
textStyle={{ color: theme.colors.white }}
|
|
377
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
378
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
379
|
+
/>
|
|
380
|
+
<OButton
|
|
381
|
+
text={t('LOGIN', 'Login')}
|
|
382
|
+
textStyle={{ color: theme.colors.primary }}
|
|
383
|
+
bgColor={theme.colors.white}
|
|
384
|
+
borderColor={theme.colors.primary}
|
|
385
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
386
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
387
|
+
/>
|
|
388
|
+
<OButton
|
|
389
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
390
|
+
textStyle={{ color: theme.colors.black }}
|
|
391
|
+
bgColor={theme.colors.white}
|
|
392
|
+
borderColor={theme.colors.black}
|
|
393
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
394
|
+
onClick={() => setAllowedGuest(true)}
|
|
395
|
+
/>
|
|
396
|
+
</View>
|
|
397
|
+
) : (
|
|
398
|
+
<UserDetails
|
|
399
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
400
|
+
useValidationFields
|
|
401
|
+
useDefualtSessionManager
|
|
402
|
+
useSessionUser
|
|
403
|
+
isCheckout
|
|
404
|
+
phoneUpdate={phoneUpdate}
|
|
405
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
406
|
+
/>
|
|
407
|
+
)}
|
|
296
408
|
</ChUserDetails>
|
|
297
409
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
298
410
|
</ChSection>
|
|
@@ -309,27 +421,27 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
309
421
|
</ChAddress>
|
|
310
422
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
311
423
|
</ChSection>
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
424
|
+
{openCarts?.length > 0 && (
|
|
425
|
+
<ChSection>
|
|
426
|
+
<MultiCartsPaymethodsAndWallets
|
|
427
|
+
openCarts={openCarts}
|
|
428
|
+
paymethodSelected={paymethodSelected}
|
|
429
|
+
walletsPaymethod={cartGroup?.result?.wallets}
|
|
430
|
+
handleSelectPaymethod={handleSelectPaymethod}
|
|
431
|
+
handleSelectWallet={handleSelectWallet}
|
|
432
|
+
handlePaymethodDataChange={handlePaymethodDataChange}
|
|
433
|
+
cartUuid={cartUuid}
|
|
434
|
+
merchantId={merchantId}
|
|
435
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
436
|
+
methodPaySupported={methodPaySupported}
|
|
437
|
+
placeByMethodPay={placeByMethodPay}
|
|
438
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
439
|
+
cartTotal={totalCartsPrice}
|
|
440
|
+
handlePlaceOrder={handlePlaceOrder}
|
|
441
|
+
/>
|
|
442
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
443
|
+
</ChSection>
|
|
444
|
+
)}
|
|
333
445
|
{
|
|
334
446
|
isMultiDriverTips &&
|
|
335
447
|
options?.type === 1 &&
|
|
@@ -364,6 +476,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
364
476
|
validationFields?.fields?.checkout?.coupon?.enabled &&
|
|
365
477
|
openCarts.every((cart: any) => cart.business_id && cart.status !== 2) &&
|
|
366
478
|
configs?.multi_business_checkout_coupon_input_style?.value === 'group' &&
|
|
479
|
+
openCarts?.length > 0 &&
|
|
367
480
|
(
|
|
368
481
|
<ChSection>
|
|
369
482
|
<OText size={14} lineHeight={20} color={theme.colors.textNormal}>
|
|
@@ -390,7 +503,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
390
503
|
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
391
504
|
</OText>
|
|
392
505
|
</CartsHeader>
|
|
393
|
-
{
|
|
506
|
+
{cartsToShow.map((cart: any) => (
|
|
394
507
|
<React.Fragment key={cart.uuid}>
|
|
395
508
|
<Cart
|
|
396
509
|
cart={cart}
|
|
@@ -407,7 +520,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
407
520
|
)}
|
|
408
521
|
</React.Fragment>
|
|
409
522
|
))}
|
|
410
|
-
{!cartGroup?.loading && openCarts.length === 0 && (
|
|
523
|
+
{!cartGroup?.loading && openCarts.length === 0 && cartsInvalid?.length === 0 && (
|
|
411
524
|
<CCNotCarts>
|
|
412
525
|
<OText size={24} style={{ textAlign: 'center' }}>
|
|
413
526
|
{t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
@@ -465,6 +578,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
465
578
|
</OText>
|
|
466
579
|
</View>
|
|
467
580
|
)}
|
|
581
|
+
|
|
468
582
|
<OText size={12} color={theme.colors.mediumGray} mRight={70} style={{ marginTop: 10 }}>
|
|
469
583
|
{t('MULTI_CHECKOUT_DESCRIPTION', 'You will receive a receipt for each business. The payment is not combined between multiple stores. Each payment is processed by the store')}
|
|
470
584
|
</OText>
|
|
@@ -472,7 +586,67 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
472
586
|
)}
|
|
473
587
|
</ChCarts>
|
|
474
588
|
</ChSection>
|
|
589
|
+
{cartsToShow?.some((cart: any) => !cart?.valid_products && cart?.status !== 2) && (
|
|
590
|
+
<OText
|
|
591
|
+
color={theme.colors.error}
|
|
592
|
+
size={12}
|
|
593
|
+
>
|
|
594
|
+
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
595
|
+
</OText>
|
|
596
|
+
)}
|
|
475
597
|
</ChContainer>
|
|
598
|
+
<OModal
|
|
599
|
+
open={openModal.signup}
|
|
600
|
+
onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
|
|
601
|
+
>
|
|
602
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
603
|
+
<SignupForm
|
|
604
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
605
|
+
isGuest
|
|
606
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
607
|
+
useSignupByEmail
|
|
608
|
+
useChekoutFileds
|
|
609
|
+
/>
|
|
610
|
+
</ScrollView>
|
|
611
|
+
</OModal>
|
|
612
|
+
<OModal
|
|
613
|
+
open={openModal.login}
|
|
614
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
615
|
+
>
|
|
616
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
617
|
+
<LoginForm
|
|
618
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
619
|
+
isGuest
|
|
620
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
621
|
+
loginButtonBackground={theme.colors.primary}
|
|
622
|
+
/>
|
|
623
|
+
</ScrollView>
|
|
624
|
+
</OModal>
|
|
625
|
+
<OModal
|
|
626
|
+
open={isOpen}
|
|
627
|
+
onClose={() => setIsOpen(false)}
|
|
628
|
+
>
|
|
629
|
+
<View style={styles.detailWrapper}>
|
|
630
|
+
<UserDetails
|
|
631
|
+
isUserDetailsEdit
|
|
632
|
+
useValidationFields
|
|
633
|
+
useDefualtSessionManager
|
|
634
|
+
useSessionUser
|
|
635
|
+
isCheckout
|
|
636
|
+
isEdit
|
|
637
|
+
phoneUpdate={phoneUpdate}
|
|
638
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
639
|
+
requiredFields={requiredFields}
|
|
640
|
+
hideUpdateButton
|
|
641
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
642
|
+
onClose={() => {
|
|
643
|
+
setIsOpen(false)
|
|
644
|
+
handlePlaceOrder()
|
|
645
|
+
}}
|
|
646
|
+
setIsOpen={setIsOpen}
|
|
647
|
+
/>
|
|
648
|
+
</View>
|
|
649
|
+
</OModal>
|
|
476
650
|
</Container>
|
|
477
651
|
|
|
478
652
|
<FloatingButton
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import styled from 'styled-components/native'
|
|
2
2
|
|
|
3
|
+
export const TopActions = styled.TouchableOpacity`
|
|
4
|
+
height: 60px;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
min-width: 30px;
|
|
7
|
+
padding-right: 15px;
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export const TopHeader = styled.View`
|
|
11
|
+
width: 100%;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
height: 60px;
|
|
17
|
+
min-height: 60px;
|
|
18
|
+
`
|
|
19
|
+
|
|
3
20
|
export const ChContainer = styled.View`
|
|
4
21
|
margin-bottom: 60px;
|
|
5
22
|
`
|