ordering-ui-react-native 0.15.92 → 0.15.93-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 +7 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessInformation/index.tsx +14 -0
- package/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +2 -1
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/Messages/index.tsx +2 -2
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptions/index.tsx +335 -365
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -1
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SignupForm/index.tsx +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/SingleProductReview/index.tsx +1 -1
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/StripeMethodForm/index.tsx +22 -24
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/index.tsx +2 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessesListing.tsx +7 -6
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- package/src/utils/index.tsx +1 -2
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +1 -1
- package/themes/business/src/components/Chat/index.tsx +14 -6
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
- package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +1 -1
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +6 -4
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -18
- package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
- package/themes/business/src/components/OrdersOption/index.tsx +65 -21
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +1 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
- package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
- package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
- package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
- package/themes/business/src/components/shared/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/components/shared/OModal.tsx +41 -38
- package/themes/business/src/types/index.tsx +14 -9
- 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/BusinessMenu/index.tsx +25 -26
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +10 -11
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- 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/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +55 -53
- package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +1 -0
- package/themes/original/index.tsx +22 -0
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +137 -134
- package/themes/original/src/components/AddressList/index.tsx +2 -2
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +179 -96
- package/themes/original/src/components/BusinessController/styles.tsx +5 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -8
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +296 -178
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
- package/themes/original/src/components/Cart/index.tsx +82 -37
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/CartContent/index.tsx +22 -16
- package/themes/original/src/components/Checkout/index.tsx +107 -67
- package/themes/original/src/components/Checkout/styles.tsx +0 -1
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/GPSButton/index.tsx +25 -17
- package/themes/original/src/components/GoogleMap/index.tsx +21 -12
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
- package/themes/original/src/components/HelpGuide/index.tsx +8 -3
- package/themes/original/src/components/HelpOrder/index.tsx +8 -3
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
- package/themes/original/src/components/LoginForm/index.tsx +16 -10
- package/themes/original/src/components/Messages/index.tsx +17 -17
- package/themes/original/src/components/MomentSelector/index.tsx +197 -0
- package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +132 -27
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/NavBar/index.tsx +11 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +138 -58
- package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
- package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
- package/themes/original/src/components/OrderProgress/index.tsx +8 -2
- package/themes/original/src/components/OrderSummary/index.tsx +2 -35
- package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +138 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -23
- package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
- package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +694 -647
- package/themes/original/src/components/ProductForm/styles.tsx +9 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/Promotions/index.tsx +4 -4
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
- package/themes/original/src/components/SearchBar/index.tsx +13 -5
- package/themes/original/src/components/ServiceForm/index.tsx +579 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- package/themes/original/src/components/SignupForm/index.tsx +237 -127
- package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +204 -95
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
- package/themes/original/src/components/UserDetails/index.tsx +32 -18
- package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
- package/themes/original/src/components/UserProfile/index.tsx +4 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +176 -162
- package/themes/original/src/components/Wallets/styles.tsx +10 -8
- package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
- package/themes/original/src/components/shared/OButton.tsx +10 -3
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +197 -47
- package/themes/original/src/utils/index.tsx +77 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -20,7 +20,10 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
20
20
|
onBusinessClick,
|
|
21
21
|
navigation,
|
|
22
22
|
isLoading,
|
|
23
|
-
getBusinesses
|
|
23
|
+
getBusinesses,
|
|
24
|
+
favoriteIds,
|
|
25
|
+
setFavoriteIds,
|
|
26
|
+
handleUpdateBusinessList
|
|
24
27
|
} = props;
|
|
25
28
|
|
|
26
29
|
const [, t] = useLanguage()
|
|
@@ -33,6 +36,17 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
33
36
|
getBusinesses(true)
|
|
34
37
|
}, [isLoading])
|
|
35
38
|
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!businessesList?.businesses?.length) return
|
|
41
|
+
const ids = [...favoriteIds]
|
|
42
|
+
businessesList.businesses.forEach(business => {
|
|
43
|
+
if (business?.favorite) {
|
|
44
|
+
ids.push(business.id)
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
setFavoriteIds([...new Set(ids)])
|
|
48
|
+
}, [businessesList?.businesses?.length])
|
|
49
|
+
|
|
36
50
|
return (
|
|
37
51
|
<>
|
|
38
52
|
|
|
@@ -123,6 +137,9 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
123
137
|
handleCustomClick={onBusinessClick}
|
|
124
138
|
orderType={orderState?.options?.type}
|
|
125
139
|
navigation={navigation}
|
|
140
|
+
favoriteIds={favoriteIds}
|
|
141
|
+
setFavoriteIds={setFavoriteIds}
|
|
142
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
126
143
|
/>
|
|
127
144
|
</View>
|
|
128
145
|
)
|
|
@@ -15,7 +15,8 @@ export const Otp = (props: otpParams) => {
|
|
|
15
15
|
setWillVerifyOtpState,
|
|
16
16
|
onSubmit,
|
|
17
17
|
handleLoginOtp,
|
|
18
|
-
setAlertState
|
|
18
|
+
setAlertState,
|
|
19
|
+
pinCount
|
|
19
20
|
} = props
|
|
20
21
|
|
|
21
22
|
const theme = useTheme();
|
|
@@ -65,7 +66,7 @@ export const Otp = (props: otpParams) => {
|
|
|
65
66
|
</OText>
|
|
66
67
|
<OTPInputView
|
|
67
68
|
style={{ width: '100%', height: 150 }}
|
|
68
|
-
pinCount={6}
|
|
69
|
+
pinCount={pinCount || 6}
|
|
69
70
|
codeInputFieldStyle={loginStyle.underlineStyleBase}
|
|
70
71
|
codeInputHighlightStyle={loginStyle.underlineStyleHighLighted}
|
|
71
72
|
onCodeFilled={(code: string) => handleLoginOtp(code)}
|
|
@@ -99,6 +99,11 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
99
99
|
const theme = useTheme();
|
|
100
100
|
const isOtpEmail = loginTab === 'otp' && otpType === 'email'
|
|
101
101
|
const isOtpCellphone = loginTab === 'otp' && otpType === 'cellphone'
|
|
102
|
+
|
|
103
|
+
const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
|
|
104
|
+
const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
|
|
105
|
+
const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
|
|
106
|
+
|
|
102
107
|
const loginStyle = StyleSheet.create({
|
|
103
108
|
btnOutline: {
|
|
104
109
|
backgroundColor: '#FFF',
|
|
@@ -251,7 +256,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
251
256
|
})
|
|
252
257
|
}
|
|
253
258
|
|
|
254
|
-
const handleCategoryScroll = (opc
|
|
259
|
+
const handleCategoryScroll = (opc: string) => {
|
|
255
260
|
tabsRef.current.scrollTo({
|
|
256
261
|
x: tabLayouts?.[opc]?.x - 40,
|
|
257
262
|
animated: true
|
|
@@ -346,15 +351,15 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
346
351
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
347
352
|
/>
|
|
348
353
|
<FormSide>
|
|
349
|
-
{((useLoginByEmail
|
|
354
|
+
{(Number(useLoginByEmail) + Number(useLoginByCellphone) + Number(useLoginOtpEmail) + Number(useLoginOtpCellphone) > 1) && (
|
|
350
355
|
<LoginWith>
|
|
351
356
|
<OTabs
|
|
352
|
-
horizontal
|
|
357
|
+
horizontal
|
|
353
358
|
showsHorizontalScrollIndicator={false}
|
|
354
359
|
ref={tabsRef}
|
|
355
360
|
>
|
|
356
361
|
{useLoginByEmail && (
|
|
357
|
-
<TabBtn
|
|
362
|
+
<TabBtn
|
|
358
363
|
onPress={() => handleChangeTab('email')}
|
|
359
364
|
onLayout={(event: any) => handleOnLayout(event, 'email')}
|
|
360
365
|
>
|
|
@@ -379,7 +384,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
379
384
|
</TabBtn>
|
|
380
385
|
)}
|
|
381
386
|
{useLoginByCellphone && (
|
|
382
|
-
<TabBtn
|
|
387
|
+
<TabBtn
|
|
383
388
|
onPress={() => handleChangeTab('cellphone')}
|
|
384
389
|
onLayout={(event: any) => handleOnLayout(event, 'cellphone')}
|
|
385
390
|
>
|
|
@@ -404,7 +409,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
404
409
|
</TabBtn>
|
|
405
410
|
)}
|
|
406
411
|
{useLoginOtpEmail && (
|
|
407
|
-
<TabBtn
|
|
412
|
+
<TabBtn
|
|
408
413
|
onPress={() => handleChangeOtpType('email')}
|
|
409
414
|
onLayout={(event: any) => handleOnLayout(event, 'otp_email')}
|
|
410
415
|
>
|
|
@@ -429,7 +434,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
429
434
|
</TabBtn>
|
|
430
435
|
)}
|
|
431
436
|
{useLoginOtpCellphone && (
|
|
432
|
-
<TabBtn
|
|
437
|
+
<TabBtn
|
|
433
438
|
onPress={() => handleChangeOtpType('cellphone')}
|
|
434
439
|
onLayout={(event: any) => handleOnLayout(event, 'otp_cellphone')}
|
|
435
440
|
>
|
|
@@ -702,7 +707,8 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
702
707
|
<ButtonsWrapper>
|
|
703
708
|
<SocialButtons>
|
|
704
709
|
{(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
|
|
705
|
-
configs?.facebook_id?.value &&
|
|
710
|
+
configs?.facebook_id?.value &&
|
|
711
|
+
facebookLoginEnabled && (
|
|
706
712
|
<FacebookLogin
|
|
707
713
|
notificationState={notificationState}
|
|
708
714
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
@@ -710,7 +716,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
710
716
|
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
711
717
|
/>
|
|
712
718
|
)}
|
|
713
|
-
{(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
|
|
719
|
+
{(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
|
|
714
720
|
<GoogleLogin
|
|
715
721
|
notificationState={notificationState}
|
|
716
722
|
webClientId={configs?.google_login_client_id?.value}
|
|
@@ -719,7 +725,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
719
725
|
handleSuccessGoogleLogin={handleSuccessFacebook}
|
|
720
726
|
/>
|
|
721
727
|
)}
|
|
722
|
-
{(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
|
|
728
|
+
{(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && appleLoginEnabled && (
|
|
723
729
|
<AppleLogin
|
|
724
730
|
notificationState={notificationState}
|
|
725
731
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
@@ -5,6 +5,7 @@ import { launchImageLibrary } from 'react-native-image-picker'
|
|
|
5
5
|
import { GiftedChat, Actions, ActionsProps, InputToolbar, Composer, Send, Bubble, MessageImage, InputToolbarProps, ComposerProps } from 'react-native-gifted-chat'
|
|
6
6
|
import { USER_TYPE } from '../../config/constants'
|
|
7
7
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
8
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
8
9
|
import { OIcon, OIconButton, OText, OButton } from '../shared'
|
|
9
10
|
import { TouchableOpacity, ActivityIndicator, StyleSheet, View, Platform, Keyboard } from 'react-native'
|
|
10
11
|
import { Header, TitleHeader, Wrapper, QuickMessageContainer, ProfileMessageHeader, MessageTypeItem } from './styles'
|
|
@@ -36,7 +37,7 @@ const ORDER_STATUS: any = {
|
|
|
36
37
|
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
37
38
|
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
38
39
|
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
39
|
-
|
|
40
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const filterSpecialStatus = ['prepared_in', 'delivered_in', 'delivery_datetime']
|
|
@@ -122,18 +123,17 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
122
123
|
|
|
123
124
|
const messageConsole = (message: any) => {
|
|
124
125
|
return message.change?.attribute !== 'driver_id'
|
|
125
|
-
?
|
|
126
|
-
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${
|
|
127
|
-
filterSpecialStatus.includes(message.change.attribute) ?
|
|
128
|
-
`${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
|
|
129
|
-
`${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
|
|
130
|
-
}`
|
|
131
|
-
: message.change.new
|
|
132
126
|
?
|
|
133
|
-
`${
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
127
|
+
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
|
|
128
|
+
`${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
|
|
129
|
+
`${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
|
|
130
|
+
}`
|
|
131
|
+
: message.change.new
|
|
132
|
+
?
|
|
133
|
+
`${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
|
|
134
|
+
:
|
|
135
|
+
`${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
|
|
136
|
+
}
|
|
137
137
|
|
|
138
138
|
useEffect(() => {
|
|
139
139
|
let newMessages: Array<any> = []
|
|
@@ -402,7 +402,9 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
402
402
|
<Wrapper>
|
|
403
403
|
{!isMeesageListing ? (
|
|
404
404
|
<Header>
|
|
405
|
-
<
|
|
405
|
+
<TouchableOpacity onPress={onClose} style={{ paddingStart: 10, borderColor: theme.colors.clear }}>
|
|
406
|
+
<AntDesignIcon name='arrowleft' size={26} />
|
|
407
|
+
</TouchableOpacity>
|
|
406
408
|
<View style={{ marginRight: 10, shadowColor: theme.colors.black, shadowOpacity: 0.1, shadowOffset: { width: 0, height: 1 }, shadowRadius: 2 }}>
|
|
407
409
|
<OIcon
|
|
408
410
|
url={type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo}
|
|
@@ -419,10 +421,8 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
419
421
|
) : (
|
|
420
422
|
<ProfileMessageHeader>
|
|
421
423
|
<View style={{ ...styles.headerTitle }}>
|
|
422
|
-
<TouchableOpacity
|
|
423
|
-
|
|
424
|
-
onPress={onClose}>
|
|
425
|
-
<OIcon src={theme.images.general.arrow_left} width={16} />
|
|
424
|
+
<TouchableOpacity onPress={onClose} style={styles.headerItem}>
|
|
425
|
+
<AntDesignIcon name='arrowleft' size={26} />
|
|
426
426
|
</TouchableOpacity>
|
|
427
427
|
<OText size={18}>{t('ORDER', theme?.defaultLanguages?.ORDER || 'Order')} #{order?.id}</OText>
|
|
428
428
|
</View>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { StyleSheet, View, Platform } from 'react-native'
|
|
3
|
+
import SelectDropdown from 'react-native-select-dropdown'
|
|
4
|
+
import { useTheme } from 'styled-components/native'
|
|
5
|
+
import {
|
|
6
|
+
MomentOption as MomentOptionController,
|
|
7
|
+
useConfig,
|
|
8
|
+
useUtils
|
|
9
|
+
} from 'ordering-components/native'
|
|
10
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
11
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
12
|
+
import { Container } from './styles'
|
|
13
|
+
import moment from 'moment'
|
|
14
|
+
|
|
15
|
+
const MomentSelectorUI = (props: any) => {
|
|
16
|
+
const {
|
|
17
|
+
datesList,
|
|
18
|
+
hoursList,
|
|
19
|
+
dateSelected,
|
|
20
|
+
timeSelected,
|
|
21
|
+
handleChangeDate,
|
|
22
|
+
handleChangeTime,
|
|
23
|
+
} = props
|
|
24
|
+
|
|
25
|
+
const theme = useTheme()
|
|
26
|
+
const { top } = useSafeAreaInsets()
|
|
27
|
+
const [{ configs }] = useConfig()
|
|
28
|
+
const [{ parseTime }] = useUtils()
|
|
29
|
+
|
|
30
|
+
const [customizedDateList, setCustomizedDateList] = useState([])
|
|
31
|
+
const [customizedTimeList, setCustomizedTimeList] = useState([])
|
|
32
|
+
|
|
33
|
+
const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
|
|
34
|
+
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
selectOption: {
|
|
37
|
+
width: '100%',
|
|
38
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
39
|
+
paddingVertical: 5,
|
|
40
|
+
paddingHorizontal: 14,
|
|
41
|
+
flexDirection: 'row-reverse',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
justifyContent: 'space-between',
|
|
44
|
+
height: 30
|
|
45
|
+
},
|
|
46
|
+
selectWrapper: {
|
|
47
|
+
flex: 1
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const updatedDatesList = datesList?.map((date: any) => {
|
|
53
|
+
return { value: moment(date).format('MMM DD, YYYY'), key: date }
|
|
54
|
+
})
|
|
55
|
+
setCustomizedDateList(updatedDatesList)
|
|
56
|
+
}, [datesList])
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (hoursList?.length > 0) {
|
|
60
|
+
|
|
61
|
+
const updatedHoursList = hoursList?.map((hour: any) => {
|
|
62
|
+
const timeValue = is12hours ? (
|
|
63
|
+
hour?.startTime?.includes('12')
|
|
64
|
+
? `${hour.startTime}PM`
|
|
65
|
+
: parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|
|
66
|
+
) : (
|
|
67
|
+
parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'HH:mm' })
|
|
68
|
+
)
|
|
69
|
+
return { value: timeValue, key: hour.startTime }
|
|
70
|
+
})
|
|
71
|
+
setCustomizedTimeList(updatedHoursList)
|
|
72
|
+
}
|
|
73
|
+
}, [hoursList])
|
|
74
|
+
|
|
75
|
+
const dropDownIcon = () => {
|
|
76
|
+
return (
|
|
77
|
+
<IconAntDesign
|
|
78
|
+
name='down'
|
|
79
|
+
color={theme.colors.textThird}
|
|
80
|
+
size={12}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Container>
|
|
87
|
+
<View style={styles.selectWrapper}>
|
|
88
|
+
<SelectDropdown
|
|
89
|
+
defaultValue={customizedDateList?.find((item: any) => item.key === dateSelected)}
|
|
90
|
+
data={customizedDateList}
|
|
91
|
+
onSelect={(selectedItem, index) => {
|
|
92
|
+
handleChangeDate(selectedItem?.key)
|
|
93
|
+
}}
|
|
94
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
95
|
+
return selectedItem?.value
|
|
96
|
+
}}
|
|
97
|
+
rowTextForSelection={(item, index) => {
|
|
98
|
+
return item.value
|
|
99
|
+
}}
|
|
100
|
+
buttonStyle={{borderTopLeftRadius: 7.6, borderBottomLeftRadius: 7.6, ...styles.selectOption}}
|
|
101
|
+
buttonTextStyle={{
|
|
102
|
+
color: theme.colors.disabled,
|
|
103
|
+
fontSize: 12,
|
|
104
|
+
textAlign: 'left',
|
|
105
|
+
marginHorizontal: 0
|
|
106
|
+
}}
|
|
107
|
+
dropdownStyle={{
|
|
108
|
+
borderRadius: 8,
|
|
109
|
+
borderColor: theme.colors.lightGray,
|
|
110
|
+
marginTop: Platform.OS === 'ios' ? 12 : -top
|
|
111
|
+
}}
|
|
112
|
+
rowStyle={{
|
|
113
|
+
borderBottomColor: theme.colors.backgroundGray100,
|
|
114
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
115
|
+
height: 30,
|
|
116
|
+
flexDirection: 'column',
|
|
117
|
+
alignItems: 'flex-start',
|
|
118
|
+
paddingTop: 8,
|
|
119
|
+
paddingHorizontal: 12
|
|
120
|
+
}}
|
|
121
|
+
rowTextStyle={{
|
|
122
|
+
color: theme.colors.disabled,
|
|
123
|
+
fontSize: 12,
|
|
124
|
+
marginHorizontal: 0
|
|
125
|
+
}}
|
|
126
|
+
renderDropdownIcon={() => dropDownIcon()}
|
|
127
|
+
dropdownOverlayColor='transparent'
|
|
128
|
+
/>
|
|
129
|
+
</View>
|
|
130
|
+
<View style={styles.selectWrapper}>
|
|
131
|
+
<SelectDropdown
|
|
132
|
+
defaultValue={customizedTimeList?.find((item: any) => item.key === timeSelected)}
|
|
133
|
+
data={customizedTimeList}
|
|
134
|
+
onSelect={(selectedItem, index) => {
|
|
135
|
+
handleChangeTime(selectedItem.key)
|
|
136
|
+
}}
|
|
137
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
138
|
+
return selectedItem.value
|
|
139
|
+
}}
|
|
140
|
+
rowTextForSelection={(item, index) => {
|
|
141
|
+
return item.value
|
|
142
|
+
}}
|
|
143
|
+
buttonStyle={{borderTopRightRadius: 7.6, borderBottomRightRadius: 7.6, ...styles.selectOption}}
|
|
144
|
+
buttonTextStyle={{
|
|
145
|
+
color: theme.colors.disabled,
|
|
146
|
+
fontSize: 12,
|
|
147
|
+
textAlign: 'left',
|
|
148
|
+
marginHorizontal: 0
|
|
149
|
+
}}
|
|
150
|
+
dropdownStyle={{
|
|
151
|
+
borderRadius: 8,
|
|
152
|
+
borderColor: theme.colors.lightGray,
|
|
153
|
+
marginTop: Platform.OS === 'ios' ? 12 : -top
|
|
154
|
+
}}
|
|
155
|
+
rowStyle={{
|
|
156
|
+
borderBottomColor: theme.colors.backgroundGray100,
|
|
157
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
158
|
+
height: 30,
|
|
159
|
+
flexDirection: 'column',
|
|
160
|
+
alignItems: 'flex-start',
|
|
161
|
+
paddingTop: 8,
|
|
162
|
+
paddingHorizontal: 14
|
|
163
|
+
}}
|
|
164
|
+
rowTextStyle={{
|
|
165
|
+
color: theme.colors.disabled,
|
|
166
|
+
fontSize: 12,
|
|
167
|
+
marginHorizontal: 0
|
|
168
|
+
}}
|
|
169
|
+
renderDropdownIcon={() => dropDownIcon()}
|
|
170
|
+
dropdownOverlayColor='transparent'
|
|
171
|
+
/>
|
|
172
|
+
</View>
|
|
173
|
+
</Container>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export const MomentSelector = (props: any) => {
|
|
178
|
+
const [{ configs }] = useConfig()
|
|
179
|
+
|
|
180
|
+
const limitDays = parseInt(configs?.max_days_preorder?.value, 10)
|
|
181
|
+
|
|
182
|
+
const currentDate = new Date()
|
|
183
|
+
const time = limitDays > 1
|
|
184
|
+
? currentDate.getTime() + ((limitDays - 1) * 24 * 60 * 60 * 1000)
|
|
185
|
+
: limitDays === 1 ? currentDate.getTime() : currentDate.getTime() + (6 * 24 * 60 * 60 * 1000)
|
|
186
|
+
|
|
187
|
+
currentDate.setTime(time)
|
|
188
|
+
currentDate.setHours(23)
|
|
189
|
+
currentDate.setMinutes(59)
|
|
190
|
+
|
|
191
|
+
const businessPreorderProps = {
|
|
192
|
+
...props,
|
|
193
|
+
UIComponent: MomentSelectorUI,
|
|
194
|
+
maxDate: currentDate
|
|
195
|
+
}
|
|
196
|
+
return <MomentOptionController {...businessPreorderProps} />
|
|
197
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
useLanguage,
|
|
4
|
+
useConfig,
|
|
5
|
+
useUtils,
|
|
6
|
+
MultiCartsPaymethodsAndWallets as MultiCartsPaymethodsAndWalletsController
|
|
7
|
+
} from 'ordering-components/native'
|
|
8
|
+
import { useTheme } from 'styled-components/native'
|
|
9
|
+
import { View, TouchableOpacity, FlatList, StyleSheet, KeyboardAvoidingView, Platform } from 'react-native'
|
|
10
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
|
|
11
|
+
import { OText, OIcon, OModal, OButton } from '../shared'
|
|
12
|
+
import { getIconCard, flatArray } from '../../utils'
|
|
13
|
+
import { StripeElementsForm } from '../StripeElementsForm'
|
|
14
|
+
import { StripeCardsList } from '../StripeCardsList'
|
|
15
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
PMContainer,
|
|
19
|
+
PMItem,
|
|
20
|
+
WalletItem
|
|
21
|
+
} from './styles'
|
|
22
|
+
|
|
23
|
+
const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
24
|
+
const {
|
|
25
|
+
businessIds,
|
|
26
|
+
paymethodsAndWallets,
|
|
27
|
+
walletsState,
|
|
28
|
+
businessPaymethods,
|
|
29
|
+
paymethodSelected,
|
|
30
|
+
handleSelectPaymethod,
|
|
31
|
+
handleSelectWallet,
|
|
32
|
+
handlePaymethodDataChange
|
|
33
|
+
} = props
|
|
34
|
+
|
|
35
|
+
const theme = useTheme()
|
|
36
|
+
const [, t] = useLanguage()
|
|
37
|
+
const [{ configs }] = useConfig()
|
|
38
|
+
const [{ parsePrice }] = useUtils()
|
|
39
|
+
|
|
40
|
+
const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
|
|
41
|
+
|
|
42
|
+
const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
|
|
43
|
+
const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
|
|
44
|
+
|
|
45
|
+
const walletName: any = {
|
|
46
|
+
cash: {
|
|
47
|
+
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
48
|
+
isActive: isWalletCashEnabled
|
|
49
|
+
},
|
|
50
|
+
credit_point: {
|
|
51
|
+
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
52
|
+
isActive: isWalletPointsEnabled
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const getPayIcon = (method: string) => {
|
|
57
|
+
switch (method) {
|
|
58
|
+
case 'cash':
|
|
59
|
+
return theme.images.general.cash
|
|
60
|
+
case 'card_delivery':
|
|
61
|
+
return theme.images.general.carddelivery
|
|
62
|
+
case 'paypal':
|
|
63
|
+
return theme.images.general.paypal
|
|
64
|
+
case 'stripe':
|
|
65
|
+
return theme.images.general.stripe
|
|
66
|
+
case 'stripe_direct':
|
|
67
|
+
return theme.images.general.stripecc
|
|
68
|
+
case 'stripe_connect':
|
|
69
|
+
return theme.images.general.stripes
|
|
70
|
+
case 'stripe_redirect':
|
|
71
|
+
return theme.images.general.stripesb
|
|
72
|
+
default:
|
|
73
|
+
return theme.images.general.creditCard
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const renderPaymethods = ({ item }: any) => {
|
|
78
|
+
return (
|
|
79
|
+
<TouchableOpacity
|
|
80
|
+
onPress={() => handleSelectPaymethod(item)}
|
|
81
|
+
>
|
|
82
|
+
<PMItem
|
|
83
|
+
key={item.id}
|
|
84
|
+
isActive={paymethodSelected?.paymethod_id === item.paymethod_id}
|
|
85
|
+
>
|
|
86
|
+
<OIcon
|
|
87
|
+
src={getPayIcon(item.paymethod?.gateway)}
|
|
88
|
+
width={20}
|
|
89
|
+
height={20}
|
|
90
|
+
color={paymethodSelected?.paymethod_id === item.paymethod_id ? theme.colors.white : theme.colors.backgroundDark}
|
|
91
|
+
/>
|
|
92
|
+
<OText
|
|
93
|
+
size={10}
|
|
94
|
+
style={{ margin: 0, marginTop: 4 }}
|
|
95
|
+
color={paymethodSelected?.paymethod_id === item.paymethod_id ? theme.colors.white : '#000'}
|
|
96
|
+
>
|
|
97
|
+
{t(item?.paymethod?.gateway.toUpperCase(), item?.paymethod?.name)}
|
|
98
|
+
</OText>
|
|
99
|
+
</PMItem>
|
|
100
|
+
</TouchableOpacity>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<PMContainer>
|
|
106
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
107
|
+
{t('PAYMENT_METHODS', 'Payment Methods')}
|
|
108
|
+
</OText>
|
|
109
|
+
{paymethodsAndWallets.loading ? (
|
|
110
|
+
<Placeholder style={{ marginTop: 10, marginBottom: 10 }} Animation={Fade}>
|
|
111
|
+
<View style={{ display: 'flex', flexDirection: 'row' }}>
|
|
112
|
+
{[...Array(3)].map((_, i) => (
|
|
113
|
+
<PlaceholderLine
|
|
114
|
+
key={i}
|
|
115
|
+
width={37}
|
|
116
|
+
height={80}
|
|
117
|
+
noMargin
|
|
118
|
+
style={{ borderRadius: 10, marginRight: 10, }}
|
|
119
|
+
/>
|
|
120
|
+
))}
|
|
121
|
+
</View>
|
|
122
|
+
</Placeholder>
|
|
123
|
+
) : (
|
|
124
|
+
<FlatList
|
|
125
|
+
horizontal
|
|
126
|
+
showsHorizontalScrollIndicator={false}
|
|
127
|
+
data={businessPaymethods.result.filter((paymethod: any) => paymethodsAndWallets.paymethods.find((item: any) => item.id === paymethod.paymethod_id))}
|
|
128
|
+
renderItem={renderPaymethods}
|
|
129
|
+
keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
|
|
130
|
+
/>
|
|
131
|
+
)}
|
|
132
|
+
{!paymethodsAndWallets.loading && !paymethodsAndWallets.error && paymethodsAndWallets.paymethods.length === 0 && (
|
|
133
|
+
<OText size={12} style={{ margin: 0 }}>
|
|
134
|
+
{t('NO_PAYMENT_METHODS', 'No payment methods!')}
|
|
135
|
+
</OText>
|
|
136
|
+
)}
|
|
137
|
+
|
|
138
|
+
{paymethodSelected?.paymethod?.gateway === 'stripe' && (
|
|
139
|
+
<View>
|
|
140
|
+
<OButton
|
|
141
|
+
text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
|
|
142
|
+
bgColor={theme.colors.white}
|
|
143
|
+
borderColor={theme.colors.primary}
|
|
144
|
+
style={styles.btnAddStyle}
|
|
145
|
+
textStyle={{ color: theme.colors.primary, fontSize: 12 }}
|
|
146
|
+
imgRightSrc={null}
|
|
147
|
+
onClick={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
|
|
148
|
+
/>
|
|
149
|
+
<StripeCardsList
|
|
150
|
+
paymethod={paymethodSelected?.paymethod}
|
|
151
|
+
businessId={businessIds[0]}
|
|
152
|
+
businessIds={businessIds}
|
|
153
|
+
publicKey={paymethodSelected?.data?.publishable}
|
|
154
|
+
payType={paymethodSelected?.paymethod?.name}
|
|
155
|
+
onSelectCard={handlePaymethodDataChange}
|
|
156
|
+
/>
|
|
157
|
+
</View>
|
|
158
|
+
)}
|
|
159
|
+
|
|
160
|
+
{(paymethodsAndWallets.loading || walletsState.loading) ? (
|
|
161
|
+
<>
|
|
162
|
+
{[...Array(2).keys()].map(i => (
|
|
163
|
+
<PlaceholderLine
|
|
164
|
+
key={i}
|
|
165
|
+
height={40}
|
|
166
|
+
noMargin
|
|
167
|
+
style={{ marginBottom: 10 }}
|
|
168
|
+
/>
|
|
169
|
+
))}
|
|
170
|
+
</>
|
|
171
|
+
) : (
|
|
172
|
+
<>
|
|
173
|
+
{walletsState.result.filter((wallet: any) => paymethodsAndWallets.wallets.find((item: any) => item.type === wallet.type)).map((wallet: any, idx: any) => walletName[wallet.type]?.isActive && (
|
|
174
|
+
<WalletItem
|
|
175
|
+
key={wallet.type}
|
|
176
|
+
isBottomBorder={idx === paymethodsAndWallets.wallets?.length - 1}
|
|
177
|
+
onPress={() => handleSelectWallet(paymethodSelected.wallet_id === wallet.id ? false : true, wallet)}
|
|
178
|
+
>
|
|
179
|
+
{paymethodSelected.wallet_id === wallet.id ? (
|
|
180
|
+
<MaterialCommunityIcons
|
|
181
|
+
name="checkbox-marked"
|
|
182
|
+
size={25}
|
|
183
|
+
color={theme.colors.primary}
|
|
184
|
+
/>
|
|
185
|
+
) : (
|
|
186
|
+
<MaterialCommunityIcons
|
|
187
|
+
name="checkbox-blank-outline"
|
|
188
|
+
size={25}
|
|
189
|
+
color={theme.colors.disabled}
|
|
190
|
+
/>
|
|
191
|
+
)}
|
|
192
|
+
<OText size={12} style={{ flex: 1, marginLeft: 15 }}>{walletName[wallet.type]?.name}</OText>
|
|
193
|
+
<OText size={12}>{parsePrice(wallet.balance)}</OText>
|
|
194
|
+
</WalletItem>
|
|
195
|
+
))}
|
|
196
|
+
</>
|
|
197
|
+
)}
|
|
198
|
+
|
|
199
|
+
<OModal
|
|
200
|
+
entireModal
|
|
201
|
+
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
202
|
+
open={addCardOpen.stripe}
|
|
203
|
+
onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
204
|
+
style={{ backgroundColor: 'red' }}
|
|
205
|
+
>
|
|
206
|
+
<KeyboardAvoidingView
|
|
207
|
+
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
|
|
208
|
+
keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
|
|
209
|
+
enabled={Platform.OS === 'ios' ? true : false}
|
|
210
|
+
>
|
|
211
|
+
<StripeElementsForm
|
|
212
|
+
toSave
|
|
213
|
+
businessId={businessIds[0]}
|
|
214
|
+
businessIds={businessIds}
|
|
215
|
+
publicKey={paymethodSelected?.data?.publishable}
|
|
216
|
+
requirements={props.clientSecret}
|
|
217
|
+
onSelectCard={handlePaymethodDataChange}
|
|
218
|
+
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
219
|
+
/>
|
|
220
|
+
</KeyboardAvoidingView>
|
|
221
|
+
</OModal>
|
|
222
|
+
</PMContainer>
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const styles = StyleSheet.create({
|
|
227
|
+
btnAddStyle: {
|
|
228
|
+
marginVertical: 20,
|
|
229
|
+
borderRadius: 7.6,
|
|
230
|
+
shadowOpacity: 0,
|
|
231
|
+
height: 44,
|
|
232
|
+
borderWidth: 1
|
|
233
|
+
},
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
export const MultiCartsPaymethodsAndWallets = (props: any) => {
|
|
238
|
+
const multiCartsPaymethodsAndWalletsProps = {
|
|
239
|
+
...props,
|
|
240
|
+
UIComponent: MultiCartsPaymethodsAndWalletsUI
|
|
241
|
+
}
|
|
242
|
+
return <MultiCartsPaymethodsAndWalletsController {...multiCartsPaymethodsAndWalletsProps} />
|
|
243
|
+
}
|