ordering-ui-react-native 0.16.18 → 0.16.19-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 -4
- 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 +10 -8
- package/src/components/BusinessInformation/index.tsx +33 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +10 -10
- 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/LanguageSelector/index.tsx +21 -16
- package/src/components/LoginForm/index.tsx +118 -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 +2 -20
- 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 +143 -61
- package/src/components/SingleProductReview/index.tsx +8 -5
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/index.tsx +2 -0
- package/src/pages/BusinessesListing.tsx +7 -6
- 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/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
- package/src/types/index.tsx +13 -9
- package/src/utils/index.tsx +0 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +42 -34
- package/themes/business/src/components/DriverMap/index.tsx +7 -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/LoginForm/index.tsx +111 -74
- package/themes/business/src/components/MapView/index.tsx +12 -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 +3 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
- 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 +17 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
- 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 +40 -37
- package/themes/business/src/types/index.tsx +15 -9
- package/themes/business/src/utils/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/BusinessMenu/index.tsx +2 -1
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- 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/LoginForm/index.tsx +121 -10
- package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
- 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/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +12 -0
- package/themes/original/src/components/AddressForm/index.tsx +136 -133
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- 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 +173 -108
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -6
- 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/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 +49 -52
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +287 -175
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -8
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
- 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 +676 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +103 -495
- package/themes/original/src/components/Cart/index.tsx +42 -10
- 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 +106 -66
- package/themes/original/src/components/Checkout/styles.tsx +0 -1
- package/themes/original/src/components/DriverTips/index.tsx +4 -4
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -0
- package/themes/original/src/components/Favorite/styles.tsx +1 -0
- package/themes/original/src/components/FavoriteList/index.tsx +142 -93
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GoogleMap/index.tsx +20 -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/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
- package/themes/original/src/components/LoginForm/index.tsx +82 -44
- 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/MultiCheckout/index.tsx +6 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
- package/themes/original/src/components/MyOrders/index.tsx +68 -6
- package/themes/original/src/components/NavBar/index.tsx +15 -9
- package/themes/original/src/components/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/Notifications/index.tsx +148 -0
- package/themes/original/src/components/Notifications/styles.tsx +17 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +200 -42
- package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +75 -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 +1 -34
- package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +100 -106
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
- package/themes/original/src/components/OrdersOption/index.tsx +71 -55
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- 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 +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +712 -655
- package/themes/original/src/components/ProductForm/styles.tsx +9 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +170 -128
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
- package/themes/original/src/components/ReviewProducts/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 +10 -5
- package/themes/original/src/components/ServiceForm/index.tsx +631 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- package/themes/original/src/components/SignupForm/index.tsx +350 -206
- package/themes/original/src/components/SingleOrderCard/index.tsx +214 -179
- package/themes/original/src/components/SingleProductCard/index.tsx +194 -108
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +15 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
- package/themes/original/src/components/UserDetails/index.tsx +31 -17
- package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
- package/themes/original/src/components/UserProfile/index.tsx +57 -29
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
- 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 +174 -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/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +124 -30
- package/themes/original/src/utils/index.tsx +77 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -5,147 +5,146 @@ import WebView from 'react-native-webview';
|
|
|
5
5
|
import { ActivityIndicator } from 'react-native-paper';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
ToastType,
|
|
9
|
+
useToast,
|
|
10
|
+
useApi,
|
|
11
|
+
useLanguage,
|
|
12
|
+
useConfig
|
|
13
13
|
} from 'ordering-components/native';
|
|
14
14
|
|
|
15
15
|
import { OText } from '../shared';
|
|
16
16
|
|
|
17
17
|
interface PaymentOptionsWebViewParams {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
onNavigationRedirect?: Function,
|
|
19
|
+
uri?: any,
|
|
20
|
+
user?: any,
|
|
21
|
+
token?: any,
|
|
22
|
+
cart?: any,
|
|
23
|
+
currency?: any,
|
|
24
|
+
webviewPaymethod?: any,
|
|
25
|
+
setShowGateway?: any,
|
|
26
|
+
setOpenOrderCreating?: any,
|
|
27
|
+
locationId?: any
|
|
28
28
|
}
|
|
29
29
|
export const PaymentOptionsWebView = (props: PaymentOptionsWebViewParams) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
const {
|
|
31
|
+
onNavigationRedirect,
|
|
32
|
+
uri,
|
|
33
|
+
user,
|
|
34
|
+
token,
|
|
35
|
+
cart,
|
|
36
|
+
currency,
|
|
37
|
+
webviewPaymethod,
|
|
38
|
+
setShowGateway,
|
|
39
|
+
setOpenOrderCreating,
|
|
40
|
+
locationId
|
|
41
|
+
} = props
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
const webviewRef = useRef<any>(null)
|
|
44
|
+
const [, { showToast }] = useToast();
|
|
45
|
+
const [ordering] = useApi()
|
|
46
|
+
const [{ configs }] = useConfig();
|
|
47
|
+
const [, t] = useLanguage();
|
|
48
48
|
|
|
49
|
+
|
|
50
|
+
const [progClr, setProgClr] = useState('#424242');
|
|
51
|
+
const [prog, setProg] = useState(true);
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
const [prog, setProg] = useState(true);
|
|
52
|
-
|
|
53
|
-
const handleCloseWebview = () => {
|
|
53
|
+
const handleCloseWebview = () => {
|
|
54
54
|
setProg(true);
|
|
55
55
|
setShowGateway({ open: false, closedByUser: true })
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
const onMessage = (e: any) => {
|
|
59
|
+
if (e?.nativeEvent?.data && e?.nativeEvent?.data !== 'undefined') {
|
|
60
|
+
let payment = JSON.parse(e.nativeEvent.data);
|
|
61
61
|
|
|
62
|
-
if (payment === 'api error') {
|
|
62
|
+
if (payment === 'api error' || payment === 'Cancelled by user') {
|
|
63
63
|
setShowGateway({ closedByUser: true, open: false })
|
|
64
64
|
setProg(true);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
if (payment) {
|
|
68
|
+
if (payment.error) {
|
|
69
|
+
showToast(ToastType.Error, payment.result)
|
|
70
|
+
setOpenOrderCreating && setOpenOrderCreating(false)
|
|
71
|
+
} else if (payment?.result?.order?.uuid) {
|
|
72
|
+
showToast(ToastType.Success, t('ORDER_PLACED_SUCCESSfULLY', 'The order was placed successfully'))
|
|
73
|
+
onNavigationRedirect && onNavigationRedirect('OrderDetails', { orderId: payment?.result?.order?.uuid, isFromCheckout: true})
|
|
74
|
+
}
|
|
75
|
+
setProg(true);
|
|
76
|
+
setShowGateway({ closedByUser: false, open: false })
|
|
77
|
+
}
|
|
74
78
|
}
|
|
75
|
-
|
|
76
|
-
setShowGateway({ closedByUser: false, open: false })
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
79
|
+
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
return (
|
|
82
82
|
<View style={{ zIndex: 9999, height: '100%', width: '100%', position: 'absolute', backgroundColor: 'white' }}>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
83
|
+
<Icon
|
|
84
|
+
name="x"
|
|
85
|
+
size={35}
|
|
86
|
+
style={{ backgroundColor: 'white', paddingTop: 30, paddingLeft: 10 }}
|
|
87
|
+
onPress={handleCloseWebview}
|
|
88
|
+
/>
|
|
89
|
+
<OText
|
|
90
|
+
style={{
|
|
91
|
+
textAlign: 'center',
|
|
92
|
+
fontSize: 16,
|
|
93
|
+
fontWeight: 'bold',
|
|
94
|
+
color: '#00457C',
|
|
95
|
+
marginBottom: 5,
|
|
96
|
+
marginTop: 10
|
|
97
|
+
}}>
|
|
98
|
+
{webviewPaymethod?.gateway === 'paypal' ? (t('PAYPAL_GATEWAY', 'PayPal GateWay')) : (t('SQUARE_PAYMENT', 'Square payment'))}
|
|
99
|
+
</OText>
|
|
100
|
+
<View style={{ padding: 20, opacity: prog ? 1 : 0, backgroundColor: 'white' }}>
|
|
101
|
+
<ActivityIndicator size={24} color={progClr} />
|
|
102
|
+
</View>
|
|
103
|
+
<WebView
|
|
104
|
+
source={{ uri: uri }}
|
|
105
|
+
onMessage={onMessage}
|
|
106
|
+
ref={webviewRef}
|
|
107
|
+
javaScriptEnabled={true}
|
|
108
|
+
javaScriptEnabledAndroid={true}
|
|
109
|
+
cacheEnabled={false}
|
|
110
|
+
cacheMode='LOAD_NO_CACHE'
|
|
111
|
+
style={{ flex: 1 }}
|
|
112
|
+
onShouldStartLoadWithRequest={() => true}
|
|
113
|
+
onLoadStart={() => {
|
|
114
|
+
setProg(true);
|
|
115
|
+
setProgClr('#424242');
|
|
116
|
+
}}
|
|
117
|
+
onLoadProgress={() => {
|
|
118
|
+
setProg(true);
|
|
119
|
+
setProgClr('#00457C');
|
|
120
|
+
}}
|
|
121
|
+
onLoad={() => {
|
|
122
|
+
setProg(true);
|
|
123
|
+
setProgClr('#00457C');
|
|
124
|
+
}}
|
|
125
|
+
onLoadEnd={(e) => {
|
|
126
|
+
const messageParams = locationId ? { locationId } : {}
|
|
127
|
+
const message = {
|
|
128
|
+
action: 'init',
|
|
129
|
+
data: {
|
|
130
|
+
urlPlace: `${ordering.root}/carts/${cart?.uuid}/place`,
|
|
131
|
+
urlConfirm: `${ordering.root}/carts/${cart?.uuid}/confirm`,
|
|
132
|
+
payData: {
|
|
133
|
+
paymethod_id: webviewPaymethod?.id,
|
|
134
|
+
amount: cart?.balance ?? cart?.total,
|
|
135
|
+
delivery_zone_id: cart?.delivery_zone_id,
|
|
136
|
+
user_id: user?.id,
|
|
137
|
+
user_name: user?.name
|
|
138
|
+
},
|
|
139
|
+
currency: configs?.stripe_currency?.value || currency,
|
|
140
|
+
userToken: token,
|
|
141
|
+
clientId: webviewPaymethod?.credentials?.client_id,
|
|
142
|
+
...messageParams
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
setProg(false);
|
|
146
|
+
webviewRef?.current?.postMessage?.(JSON.stringify(message))
|
|
147
|
+
}}
|
|
148
|
+
/>
|
|
149
149
|
</View>
|
|
150
|
-
|
|
151
|
-
}
|
|
150
|
+
)}
|
|
@@ -218,7 +218,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
|
|
|
218
218
|
<RatingBarContainer>
|
|
219
219
|
<LinearGradient
|
|
220
220
|
start={{ x: 0.0, y: 0.0 }}
|
|
221
|
-
end={{ x: qualificationList[dirverReviews?.qualification - 1]?.percent || 0, y: 0 }}
|
|
221
|
+
end={{ x: qualificationList[dirverReviews?.qualification - 1]?.percent || 0.0001, y: 0 }}
|
|
222
222
|
locations={[.9999, .9999]}
|
|
223
223
|
colors={[theme.colors.primary, theme.colors.lightGray]}
|
|
224
224
|
style={styles.statusBar}
|
|
@@ -238,7 +238,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
238
238
|
<RatingBarContainer>
|
|
239
239
|
<LinearGradient
|
|
240
240
|
start={{ x: 0.0, y: 0.0 }}
|
|
241
|
-
end={{ x: qualificationList[stars.quality - 1]?.percent || 0, y: 0 }}
|
|
241
|
+
end={{ x: qualificationList[stars.quality - 1]?.percent || 0.0001, y: 0.0 }}
|
|
242
242
|
locations={[.9999, .9999]}
|
|
243
243
|
colors={[theme.colors.primary, theme.colors.lightGray]}
|
|
244
244
|
style={styles.statusBar}
|
|
@@ -332,6 +332,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
332
332
|
export const ReviewOrder = (props: ReviewOrderParams) => {
|
|
333
333
|
const reviewOrderProps = {
|
|
334
334
|
...props,
|
|
335
|
+
defaultStar: 0,
|
|
335
336
|
UIComponent: ReviewOrderUI
|
|
336
337
|
}
|
|
337
338
|
return <ReviewOrderController {...reviewOrderProps} />
|
|
@@ -61,6 +61,17 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
|
|
|
61
61
|
}
|
|
62
62
|
}, [formState])
|
|
63
63
|
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const _changes = order?.products.map(product => {
|
|
66
|
+
return {
|
|
67
|
+
product_id: product?.product_id,
|
|
68
|
+
comment: '',
|
|
69
|
+
qualification: 5
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
handleChangeFormState(_changes)
|
|
73
|
+
}, [])
|
|
74
|
+
|
|
64
75
|
return (
|
|
65
76
|
<>
|
|
66
77
|
<ReviewProductsContainer>
|
|
@@ -3,6 +3,7 @@ import { View, Pressable, StyleSheet, Keyboard, Linking, Platform, TouchableOpac
|
|
|
3
3
|
import { useForm, Controller } from 'react-hook-form';
|
|
4
4
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
5
5
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
|
+
import Recaptcha from 'react-native-recaptcha-that-works'
|
|
6
7
|
|
|
7
8
|
import { PhoneInputNumber } from '../PhoneInputNumber'
|
|
8
9
|
import { FacebookLogin } from '../FacebookLogin'
|
|
@@ -23,7 +24,7 @@ import {
|
|
|
23
24
|
SocialButtons
|
|
24
25
|
} from './styles'
|
|
25
26
|
|
|
26
|
-
import { LoginWith as SignupWith, OTab, OTabs } from '../LoginForm/styles'
|
|
27
|
+
import { LoginWith as SignupWith, OTab, OTabs, RecaptchaButton } from '../LoginForm/styles'
|
|
27
28
|
|
|
28
29
|
import { _removeStoreData } from '../../providers/StoreUtil';
|
|
29
30
|
import NavBar from '../NavBar'
|
|
@@ -58,7 +59,9 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
58
59
|
setCheckPhoneCodeState,
|
|
59
60
|
handleSendVerifyCode,
|
|
60
61
|
handleCheckPhoneCode,
|
|
61
|
-
notificationState
|
|
62
|
+
notificationState,
|
|
63
|
+
enableReCaptcha,
|
|
64
|
+
handleReCaptcha
|
|
62
65
|
} = props
|
|
63
66
|
|
|
64
67
|
const theme = useTheme()
|
|
@@ -107,6 +110,9 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
107
110
|
}
|
|
108
111
|
});
|
|
109
112
|
|
|
113
|
+
const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
|
|
114
|
+
const [recaptchaVerified, setRecaptchaVerified] = useState(false)
|
|
115
|
+
|
|
110
116
|
const nameRef = useRef<any>(null)
|
|
111
117
|
const lastnameRef = useRef<any>(null)
|
|
112
118
|
const middleNameRef = useRef<any>(null)
|
|
@@ -114,6 +120,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
114
120
|
const emailRef = useRef<any>(null)
|
|
115
121
|
const phoneRef = useRef<any>(null)
|
|
116
122
|
const passwordRef = useRef<any>(null)
|
|
123
|
+
const recaptchaRef = useRef<any>({});
|
|
117
124
|
|
|
118
125
|
const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
|
|
119
126
|
|
|
@@ -196,35 +203,6 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
196
203
|
setPasswordSee(false);
|
|
197
204
|
}
|
|
198
205
|
|
|
199
|
-
const onSubmit = (values: any) => {
|
|
200
|
-
Keyboard.dismiss()
|
|
201
|
-
if (phoneInputData.error) {
|
|
202
|
-
showToast(ToastType.Error, phoneInputData.error);
|
|
203
|
-
return
|
|
204
|
-
}
|
|
205
|
-
if (
|
|
206
|
-
!phoneInputData.phone.country_phone_code &&
|
|
207
|
-
!phoneInputData.phone.cellphone &&
|
|
208
|
-
validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
209
|
-
validationFields?.fields?.checkout?.cellphone?.required
|
|
210
|
-
) {
|
|
211
|
-
showToast(ToastType.Error, t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required.'))
|
|
212
|
-
return
|
|
213
|
-
}
|
|
214
|
-
if (signupTab === 'email' || !useSignupByCellphone) {
|
|
215
|
-
handleButtonSignupClick && handleButtonSignupClick({
|
|
216
|
-
...values,
|
|
217
|
-
...phoneInputData.phone
|
|
218
|
-
})
|
|
219
|
-
if (!formState.loading && formState.result.result && !formState.result.error) {
|
|
220
|
-
handleSuccessSignup && handleSuccessSignup(formState.result.result)
|
|
221
|
-
}
|
|
222
|
-
return
|
|
223
|
-
}
|
|
224
|
-
setFormValues(values)
|
|
225
|
-
handleVerifyCodeClick(values)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
206
|
const handleVerifyCodeClick = (values: any) => {
|
|
229
207
|
const formData = values || formValues
|
|
230
208
|
handleSendVerifyCode && handleSendVerifyCode({
|
|
@@ -265,6 +243,68 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
265
243
|
}
|
|
266
244
|
}
|
|
267
245
|
|
|
246
|
+
const handleOpenRecaptcha = () => {
|
|
247
|
+
setRecaptchaVerified(false)
|
|
248
|
+
|
|
249
|
+
if (recaptchaVerified) {
|
|
250
|
+
handleReCaptcha && handleReCaptcha('')
|
|
251
|
+
return
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (!recaptchaConfig?.siteKey) {
|
|
255
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
256
|
+
return
|
|
257
|
+
}
|
|
258
|
+
if (!recaptchaConfig?.baseUrl) {
|
|
259
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
|
|
260
|
+
return
|
|
261
|
+
}
|
|
262
|
+
recaptchaRef.current.open()
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const onRecaptchaVerify = (token: any) => {
|
|
266
|
+
setRecaptchaVerified(true)
|
|
267
|
+
handleReCaptcha && handleReCaptcha(token)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const onSubmit = (values: any) => {
|
|
271
|
+
Keyboard.dismiss()
|
|
272
|
+
if (phoneInputData.error) {
|
|
273
|
+
showToast(ToastType.Error, phoneInputData.error);
|
|
274
|
+
return
|
|
275
|
+
}
|
|
276
|
+
if (
|
|
277
|
+
!phoneInputData.phone.country_phone_code &&
|
|
278
|
+
!phoneInputData.phone.cellphone &&
|
|
279
|
+
validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
280
|
+
validationFields?.fields?.checkout?.cellphone?.required
|
|
281
|
+
) {
|
|
282
|
+
showToast(ToastType.Error, t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required.'))
|
|
283
|
+
return
|
|
284
|
+
}
|
|
285
|
+
if (signupTab === 'email' || !useSignupByCellphone) {
|
|
286
|
+
handleButtonSignupClick && handleButtonSignupClick({
|
|
287
|
+
...values,
|
|
288
|
+
...phoneInputData.phone
|
|
289
|
+
})
|
|
290
|
+
if (!formState.loading && formState.result.result && !formState.result.error) {
|
|
291
|
+
handleSuccessSignup && handleSuccessSignup(formState.result.result)
|
|
292
|
+
}
|
|
293
|
+
return
|
|
294
|
+
}
|
|
295
|
+
setFormValues(values)
|
|
296
|
+
handleVerifyCodeClick(values)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
|
|
301
|
+
setRecaptchaConfig({
|
|
302
|
+
siteKey: configs?.security_recaptcha_site_key?.value || null,
|
|
303
|
+
baseUrl: configs?.security_recaptcha_base_url?.value || null
|
|
304
|
+
})
|
|
305
|
+
}
|
|
306
|
+
}, [configs, enableReCaptcha])
|
|
307
|
+
|
|
268
308
|
useEffect(() => {
|
|
269
309
|
if (!formState.loading && formState.result?.error) {
|
|
270
310
|
formState.result?.result && showToast(
|
|
@@ -492,6 +532,47 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
492
532
|
</View>
|
|
493
533
|
)}
|
|
494
534
|
|
|
535
|
+
{enableReCaptcha && (
|
|
536
|
+
<>
|
|
537
|
+
<TouchableOpacity
|
|
538
|
+
onPress={handleOpenRecaptcha}
|
|
539
|
+
style={{ marginHorizontal: 4, marginBottom: 10 }}
|
|
540
|
+
>
|
|
541
|
+
<RecaptchaButton>
|
|
542
|
+
{recaptchaVerified ? (
|
|
543
|
+
<MaterialCommunityIcons
|
|
544
|
+
name="checkbox-marked"
|
|
545
|
+
size={23}
|
|
546
|
+
color={theme.colors.primary}
|
|
547
|
+
/>
|
|
548
|
+
) : (
|
|
549
|
+
<MaterialCommunityIcons
|
|
550
|
+
name="checkbox-blank-outline"
|
|
551
|
+
size={23}
|
|
552
|
+
color={theme.colors.disabled}
|
|
553
|
+
/>
|
|
554
|
+
)}
|
|
555
|
+
<OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
|
|
556
|
+
</RecaptchaButton>
|
|
557
|
+
</TouchableOpacity>
|
|
558
|
+
<Recaptcha
|
|
559
|
+
ref={recaptchaRef}
|
|
560
|
+
siteKey={recaptchaConfig?.siteKey}
|
|
561
|
+
baseUrl={recaptchaConfig?.baseUrl}
|
|
562
|
+
onVerify={onRecaptchaVerify}
|
|
563
|
+
onExpire={() => setRecaptchaVerified(false)}
|
|
564
|
+
footerComponent={<OButton
|
|
565
|
+
onClick={() => recaptchaRef.current.close()}
|
|
566
|
+
style={{ borderRadius: 0 }}
|
|
567
|
+
text={t('CLOSE', 'Close')}
|
|
568
|
+
bgColor={theme.colors.primary}
|
|
569
|
+
borderColor={theme.colors.primary}
|
|
570
|
+
textStyle={{ color: 'white' }}
|
|
571
|
+
imgRightSrc={null}
|
|
572
|
+
/>}
|
|
573
|
+
/>
|
|
574
|
+
</>
|
|
575
|
+
)}
|
|
495
576
|
{signupTab === 'cellphone' && useSignupByEmail && useSignupByCellphone ? (
|
|
496
577
|
<OButton
|
|
497
578
|
onClick={handleSubmit(onSubmit)}
|
|
@@ -531,40 +612,40 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
531
612
|
}
|
|
532
613
|
|
|
533
614
|
{configs && Object.keys(configs).length > 0 && anySocialButtonActivated && (
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
notificationState={notificationState}
|
|
543
|
-
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
544
|
-
handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
|
|
545
|
-
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
546
|
-
/>
|
|
547
|
-
)}
|
|
548
|
-
{(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
|
|
549
|
-
<GoogleLogin
|
|
550
|
-
notificationState={notificationState}
|
|
551
|
-
webClientId={configs?.google_login_client_id?.value}
|
|
552
|
-
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
553
|
-
handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
|
|
554
|
-
handleSuccessGoogleLogin={handleSuccessFacebook}
|
|
555
|
-
/>
|
|
556
|
-
)}
|
|
557
|
-
{(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
|
|
558
|
-
<AppleLogin
|
|
615
|
+
<ButtonsSection>
|
|
616
|
+
<OText size={18} mBottom={10} color={theme.colors.disabled}>
|
|
617
|
+
{t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
|
|
618
|
+
</OText>
|
|
619
|
+
<SocialButtons>
|
|
620
|
+
{(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
|
|
621
|
+
configs?.facebook_id?.value && (
|
|
622
|
+
<FacebookLogin
|
|
559
623
|
notificationState={notificationState}
|
|
560
624
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
561
625
|
handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
|
|
562
|
-
|
|
626
|
+
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
563
627
|
/>
|
|
564
628
|
)}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
629
|
+
{(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
|
|
630
|
+
<GoogleLogin
|
|
631
|
+
notificationState={notificationState}
|
|
632
|
+
webClientId={configs?.google_login_client_id?.value}
|
|
633
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
634
|
+
handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
|
|
635
|
+
handleSuccessGoogleLogin={handleSuccessFacebook}
|
|
636
|
+
/>
|
|
637
|
+
)}
|
|
638
|
+
{(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
|
|
639
|
+
<AppleLogin
|
|
640
|
+
notificationState={notificationState}
|
|
641
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
642
|
+
handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
|
|
643
|
+
handleSuccessApple={handleSuccessApple}
|
|
644
|
+
/>
|
|
645
|
+
)}
|
|
646
|
+
</SocialButtons>
|
|
647
|
+
</ButtonsSection>
|
|
648
|
+
)}
|
|
568
649
|
</FormSide>
|
|
569
650
|
<OModal
|
|
570
651
|
open={isModalVisible}
|
|
@@ -581,13 +662,14 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
581
662
|
/>
|
|
582
663
|
</OModal>
|
|
583
664
|
<Spinner visible={formState.loading || isLoadingSocialButton} />
|
|
584
|
-
</View
|
|
665
|
+
</View>
|
|
585
666
|
);
|
|
586
667
|
};
|
|
587
668
|
|
|
588
669
|
export const SignupForm = (props: any) => {
|
|
589
670
|
const signupProps = {
|
|
590
671
|
...props,
|
|
672
|
+
isRecaptchaEnable: true,
|
|
591
673
|
UIComponent: SignupFormUI,
|
|
592
674
|
};
|
|
593
675
|
return <SignUpController {...signupProps} />;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { useLanguage } from 'ordering-components/native'
|
|
3
|
-
import { OText, OButton, OInput } from '../shared'
|
|
2
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
3
|
+
import { OText, OButton, OInput, OIcon } from '../shared'
|
|
4
4
|
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
5
5
|
import AntDesignIcons from 'react-native-vector-icons/AntDesign'
|
|
6
6
|
import { useTheme } from 'styled-components/native'
|
|
7
7
|
import { SingleProductReviewParams } from '../../types'
|
|
8
|
+
import FastImage from 'react-native-fast-image'
|
|
8
9
|
|
|
9
10
|
import {
|
|
10
11
|
ProductContainer,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
LikeHandsActionContainer,
|
|
13
14
|
LikeHandsButton,
|
|
14
15
|
CommentsButtonGroup,
|
|
16
|
+
LogoWrapper
|
|
15
17
|
} from './styles'
|
|
16
18
|
|
|
17
19
|
export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
@@ -23,6 +25,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
23
25
|
|
|
24
26
|
const [, t] = useLanguage()
|
|
25
27
|
const theme = useTheme()
|
|
28
|
+
const [{ optimizeImage }] = useUtils()
|
|
26
29
|
|
|
27
30
|
const styles = StyleSheet.create({
|
|
28
31
|
inputTextArea: {
|
|
@@ -37,7 +40,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
37
40
|
flexDirection: 'row',
|
|
38
41
|
justifyContent: 'center',
|
|
39
42
|
marginVertical: 10,
|
|
40
|
-
}
|
|
43
|
+
}
|
|
41
44
|
})
|
|
42
45
|
|
|
43
46
|
const [comments, setComments] = useState<Array<any>>([])
|
|
@@ -69,7 +72,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
useEffect(() => {
|
|
72
|
-
if (comments?.length === 0 && !extraComment
|
|
75
|
+
if (comments?.length === 0 && !extraComment) return
|
|
73
76
|
let _comments = ''
|
|
74
77
|
if (comments.length > 0) {
|
|
75
78
|
comments.map(comment => (_comments += comment.content + '. '))
|
|
@@ -129,7 +132,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
129
132
|
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
130
133
|
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
131
134
|
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
132
|
-
onClick={() => handleChangeComment(commentItem)
|
|
135
|
+
onClick={() => handleChangeComment(commentItem)}
|
|
133
136
|
/>
|
|
134
137
|
))}
|
|
135
138
|
</CommentsButtonGroup>
|