ordering-ui-react-native 0.11.33 → 0.11.34
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 +1 -1
- package/src/components/Checkout/index.tsx +9 -24
- package/src/config.json +1 -1
package/package.json
CHANGED
|
@@ -119,9 +119,7 @@ const CheckoutUI = (props: any) => {
|
|
|
119
119
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
120
120
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
121
121
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
122
|
-
const [prog, setProg] = useState(true);
|
|
123
122
|
const [showGateway, setShowGateway] = useState<any>({closedByUsed: false, open: false});
|
|
124
|
-
const [progClr, setProgClr] = useState('#424242');
|
|
125
123
|
const [paypalMethod, setPaypalMethod] = useState<any>(null)
|
|
126
124
|
|
|
127
125
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
@@ -130,7 +128,6 @@ const CheckoutUI = (props: any) => {
|
|
|
130
128
|
|
|
131
129
|
const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
132
130
|
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
133
|
-
|
|
134
131
|
const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
|
|
135
132
|
|
|
136
133
|
const handlePlaceOrder = () => {
|
|
@@ -205,8 +202,12 @@ const CheckoutUI = (props: any) => {
|
|
|
205
202
|
}
|
|
206
203
|
|
|
207
204
|
const handlePaymentMethodClick = (paymethod : any) => {
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
setShowGateway({closedByUser: false, open: true})
|
|
206
|
+
setPaypalMethod(paymethod)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const handleCloseWebview = () => {
|
|
210
|
+
setShowGateway({open: false, closedByUser: true})
|
|
210
211
|
}
|
|
211
212
|
|
|
212
213
|
useEffect(() => {
|
|
@@ -558,9 +559,9 @@ const CheckoutUI = (props: any) => {
|
|
|
558
559
|
)}
|
|
559
560
|
<OModal
|
|
560
561
|
open={paypalMethod && showGateway.open}
|
|
561
|
-
onCancel={
|
|
562
|
-
onAccept={
|
|
563
|
-
onClose={
|
|
562
|
+
onCancel={handleCloseWebview}
|
|
563
|
+
onAccept={handleCloseWebview}
|
|
564
|
+
onClose={handleCloseWebview}
|
|
564
565
|
entireModal
|
|
565
566
|
>
|
|
566
567
|
<OText
|
|
@@ -573,9 +574,6 @@ const CheckoutUI = (props: any) => {
|
|
|
573
574
|
}}>
|
|
574
575
|
{t('PAYPAL_GATEWAY', 'PayPal GateWay')}
|
|
575
576
|
</OText>
|
|
576
|
-
<View style={{padding: 13, opacity: prog ? 1 : 0}}>
|
|
577
|
-
<ActivityIndicator size={24} color={progClr} />
|
|
578
|
-
</View>
|
|
579
577
|
<WebView
|
|
580
578
|
source={{ uri: `${ordering.root}/html/paypal_react_native` }}
|
|
581
579
|
onMessage={onMessage}
|
|
@@ -585,18 +583,6 @@ const CheckoutUI = (props: any) => {
|
|
|
585
583
|
cacheEnabled={false}
|
|
586
584
|
cacheMode='LOAD_NO_CACHE'
|
|
587
585
|
style={{ flex: 1 }}
|
|
588
|
-
onLoadStart={() => {
|
|
589
|
-
setProg(true);
|
|
590
|
-
setProgClr('#424242');
|
|
591
|
-
}}
|
|
592
|
-
onLoadProgress={() => {
|
|
593
|
-
setProg(true);
|
|
594
|
-
setProgClr('#00457C');
|
|
595
|
-
}}
|
|
596
|
-
onLoad={() => {
|
|
597
|
-
setProg(true);
|
|
598
|
-
setProgClr('#00457C');
|
|
599
|
-
}}
|
|
600
586
|
onLoadEnd={(e) => {
|
|
601
587
|
const message = {
|
|
602
588
|
action: 'init',
|
|
@@ -614,7 +600,6 @@ const CheckoutUI = (props: any) => {
|
|
|
614
600
|
clientId: paypalMethod?.credentials?.client_id
|
|
615
601
|
}
|
|
616
602
|
}
|
|
617
|
-
setProg(false);
|
|
618
603
|
webviewRef.current.postMessage(JSON.stringify(message))
|
|
619
604
|
}}
|
|
620
605
|
/>
|