ordering-ui-react-native 0.17.88 → 0.17.89-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +5 -0
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +33 -26
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
- package/themes/business/src/components/LoginForm/index.tsx +15 -22
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +20 -93
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +202 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +81 -66
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +19 -18
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersOption/index.tsx +22 -22
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
- package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
- package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +25 -10
- package/themes/business/src/utils/index.tsx +29 -2
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +1 -1
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +35 -17
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +73 -37
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +347 -336
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
- package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +663 -556
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +38 -405
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +60 -51
- package/themes/original/src/components/CartContent/index.tsx +102 -58
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/Checkout/index.tsx +280 -35
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DriverTips/index.tsx +52 -34
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +86 -10
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/MomentOption/index.tsx +193 -92
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
- package/themes/original/src/components/MultiCheckout/index.tsx +385 -46
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +23 -19
- package/themes/original/src/components/MyOrders/index.tsx +25 -16
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
- package/themes/original/src/components/OrderDetails/index.tsx +50 -38
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderSummary/index.tsx +83 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
- package/themes/original/src/components/OrdersOption/index.tsx +59 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/index.tsx +87 -31
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
- package/themes/original/src/components/Promotions/index.tsx +2 -2
- package/themes/original/src/components/Promotions/styles.tsx +3 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +63 -20
- package/themes/original/src/components/Sessions/styles.tsx +1 -0
- package/themes/original/src/components/SignupForm/index.tsx +43 -27
- package/themes/original/src/components/SingleOrderCard/index.tsx +42 -19
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +37 -26
- package/themes/original/src/components/SingleProductCard/styles.tsx +9 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/Wallets/index.tsx +52 -62
- package/themes/original/src/components/Wallets/styles.tsx +2 -4
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/types/index.tsx +37 -10
- package/themes/original/src/utils/index.tsx +185 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -11,11 +11,14 @@ import {
|
|
|
11
11
|
useLanguage,
|
|
12
12
|
ToastType,
|
|
13
13
|
useToast,
|
|
14
|
+
useSession
|
|
14
15
|
} from 'ordering-components/native';
|
|
15
16
|
import { useTheme } from 'styled-components/native';
|
|
16
17
|
import { PaymentOptionCash } from '../PaymentOptionCash';
|
|
17
18
|
import { StripeElementsForm } from '../StripeElementsForm';
|
|
18
19
|
import { StripeCardsList } from '../StripeCardsList';
|
|
20
|
+
import { PaymentOptionCard } from '../PaymentOptionCard'
|
|
21
|
+
|
|
19
22
|
// import { PaymentOptionStripe } from '../PaymentOptionStripe';
|
|
20
23
|
// import { StripeRedirectForm } from '../StripeRedirectForm';
|
|
21
24
|
// import { PaymentOptionPaypal } from '../PaymentOptionPaypal'
|
|
@@ -34,7 +37,7 @@ import { useApplePay } from '@stripe/stripe-react-native';
|
|
|
34
37
|
|
|
35
38
|
const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
|
|
36
39
|
const methodsPay = ['google_pay', 'apple_pay']
|
|
37
|
-
const stripeDirectMethods = ['stripe_direct'
|
|
40
|
+
const stripeDirectMethods = ['stripe_direct']
|
|
38
41
|
// const stripeRedirectOptions = [
|
|
39
42
|
// { name: 'Bancontact', value: 'bancontact' },
|
|
40
43
|
// { name: 'Alipay', value: 'alipay' },
|
|
@@ -43,6 +46,8 @@ const stripeDirectMethods = ['stripe_direct', ...methodsPay]
|
|
|
43
46
|
// ]
|
|
44
47
|
|
|
45
48
|
const webViewPaymentGateway: any = ['paypal', 'square']
|
|
49
|
+
const multiCheckoutMethods = ['global_google_pay', 'global_apple_pay']
|
|
50
|
+
const cardsPaymethods = ['credomatic']
|
|
46
51
|
|
|
47
52
|
const PaymentOptionsUI = (props: any) => {
|
|
48
53
|
const {
|
|
@@ -59,11 +64,22 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
59
64
|
isOpenMethod,
|
|
60
65
|
handlePaymentMethodClickCustom,
|
|
61
66
|
handlePlaceOrder,
|
|
62
|
-
merchantId
|
|
67
|
+
merchantId,
|
|
68
|
+
setMethodPaySupported,
|
|
69
|
+
placeByMethodPay,
|
|
70
|
+
methodPaySupported,
|
|
71
|
+
setPlaceByMethodPay,
|
|
72
|
+
setCardList,
|
|
73
|
+
onPaymentChange,
|
|
74
|
+
requiredFields,
|
|
75
|
+
openUserModal,
|
|
76
|
+
paymethodClicked,
|
|
77
|
+
setPaymethodClicked
|
|
63
78
|
} = props
|
|
64
79
|
|
|
65
80
|
const theme = useTheme();
|
|
66
81
|
const [, { showToast }] = useToast();
|
|
82
|
+
const [{ user }] = useSession()
|
|
67
83
|
const { confirmApplePayPayment } = useApplePay()
|
|
68
84
|
|
|
69
85
|
const getPayIcon = (method: string) => {
|
|
@@ -75,7 +91,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
75
91
|
case 'paypal':
|
|
76
92
|
return theme.images.general.paypal
|
|
77
93
|
case 'stripe':
|
|
78
|
-
return theme.images.general.
|
|
94
|
+
return theme.images.general.creditCard
|
|
79
95
|
case 'stripe_direct':
|
|
80
96
|
return theme.images.general.stripecc
|
|
81
97
|
case 'stripe_connect':
|
|
@@ -84,6 +100,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
84
100
|
return theme.images.general.stripesb
|
|
85
101
|
case 'apple_pay':
|
|
86
102
|
return theme.images.general.applePayMark
|
|
103
|
+
case 'google_pay':
|
|
104
|
+
return theme.images.general.googlePayMark
|
|
87
105
|
default:
|
|
88
106
|
return theme.images.general.creditCard
|
|
89
107
|
}
|
|
@@ -91,7 +109,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
91
109
|
|
|
92
110
|
const [, t] = useLanguage();
|
|
93
111
|
|
|
94
|
-
const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
|
|
112
|
+
const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false, card: false });
|
|
95
113
|
const paymethodSelected = props.paySelected || props.paymethodSelected || isOpenMethod?.paymethod
|
|
96
114
|
// const [{ token }] = useSession()
|
|
97
115
|
|
|
@@ -101,8 +119,18 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
101
119
|
// { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
|
|
102
120
|
// ]
|
|
103
121
|
|
|
122
|
+
const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
|
|
123
|
+
|
|
104
124
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
105
|
-
if (cart?.balance > 0) {
|
|
125
|
+
if (cart?.balance > 0 || !!user?.guest_id) {
|
|
126
|
+
if (paymethodsFieldRequired.includes(paymethod?.gateway) && requiredFields.length > 0) {
|
|
127
|
+
openUserModal && openUserModal(true)
|
|
128
|
+
setPaymethodClicked({
|
|
129
|
+
confirmed: false,
|
|
130
|
+
paymethod
|
|
131
|
+
})
|
|
132
|
+
return
|
|
133
|
+
}
|
|
106
134
|
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
107
135
|
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
108
136
|
handlePaymentMethodClickCustom(paymethod)
|
|
@@ -116,6 +144,12 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
116
144
|
;
|
|
117
145
|
}
|
|
118
146
|
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (cart?.balance === 0) {
|
|
149
|
+
handlePaymethodClick(null)
|
|
150
|
+
}
|
|
151
|
+
}, [cart?.balance])
|
|
152
|
+
|
|
119
153
|
useEffect(() => {
|
|
120
154
|
if (paymethodsList.paymethods.length === 1) {
|
|
121
155
|
handlePaymethodClick && handlePaymethodClick(paymethodsList.paymethods[0])
|
|
@@ -142,10 +176,17 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
142
176
|
}
|
|
143
177
|
}, [paymethodData, paymethodSelected])
|
|
144
178
|
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
if (paymethodClicked?.confirmed) {
|
|
181
|
+
handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
|
|
182
|
+
}
|
|
183
|
+
}, [paymethodClicked?.confirmed])
|
|
184
|
+
|
|
185
|
+
|
|
145
186
|
const renderPaymethods = ({ item }: any) => {
|
|
146
187
|
return (
|
|
147
188
|
<>
|
|
148
|
-
{item?.gateway
|
|
189
|
+
{methodsPay.includes(item?.gateway) ? (
|
|
149
190
|
<TouchableOpacity
|
|
150
191
|
onPress={() => handlePaymentMethodClick(item)}
|
|
151
192
|
>
|
|
@@ -187,6 +228,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
187
228
|
}
|
|
188
229
|
|
|
189
230
|
const excludeIds: any = [32]; //exclude paypal & connect & redirect
|
|
231
|
+
const filterMethodsPay = (gateway: string) => Platform.OS === 'ios' ? gateway !== 'google_pay' : gateway !== 'apple_pay'
|
|
190
232
|
|
|
191
233
|
return (
|
|
192
234
|
<PMContainer>
|
|
@@ -195,7 +237,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
195
237
|
horizontal
|
|
196
238
|
showsHorizontalScrollIndicator={false}
|
|
197
239
|
// data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
|
|
198
|
-
data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)
|
|
240
|
+
data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)
|
|
241
|
+
.filter((p: any) =>
|
|
242
|
+
!multiCheckoutMethods.includes(p.gateway) &&
|
|
243
|
+
filterMethodsPay(p.gateway) &&
|
|
244
|
+
!excludeIds.includes(p.id))}
|
|
199
245
|
renderItem={renderPaymethods}
|
|
200
246
|
keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
|
|
201
247
|
/>
|
|
@@ -241,7 +287,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
241
287
|
/>
|
|
242
288
|
)}
|
|
243
289
|
|
|
244
|
-
{stripeOptions.includes(paymethodSelected?.gateway) &&
|
|
290
|
+
{/* {stripeOptions.includes(paymethodSelected?.gateway) &&
|
|
245
291
|
(paymethodData?.brand || paymethodData?.card?.brand) &&
|
|
246
292
|
(paymethodData?.last4 || paymethodData?.card?.last4) &&
|
|
247
293
|
(
|
|
@@ -270,10 +316,10 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
270
316
|
</View>
|
|
271
317
|
</PMCardItemContent>
|
|
272
318
|
</PMCardSelected>
|
|
273
|
-
)}
|
|
319
|
+
)} */}
|
|
274
320
|
|
|
275
321
|
{/* Stripe */}
|
|
276
|
-
{isOpenMethod?.paymethod?.gateway === 'stripe' &&
|
|
322
|
+
{isOpenMethod?.paymethod?.gateway === 'stripe' && (
|
|
277
323
|
<View>
|
|
278
324
|
<OButton
|
|
279
325
|
text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
|
|
@@ -291,35 +337,55 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
291
337
|
payType={paymethodsList?.name}
|
|
292
338
|
onSelectCard={handlePaymethodDataChange}
|
|
293
339
|
onNavigationRedirect={onNavigationRedirect}
|
|
340
|
+
paymethodCardId={paymethodData?.id}
|
|
294
341
|
onCancel={() => handlePaymethodClick(null)}
|
|
342
|
+
setAddCardOpen={setAddCardOpen}
|
|
343
|
+
addCardOpen={addCardOpen}
|
|
344
|
+
isOpenMethod={isOpenMethod}
|
|
345
|
+
handlePaymethodDataChange={handlePaymethodDataChange}
|
|
346
|
+
clientSecret={props.clientSecret}
|
|
347
|
+
businessId={props.businessId}
|
|
348
|
+
onPaymentChange={onPaymentChange}
|
|
295
349
|
/>
|
|
296
350
|
</View>
|
|
297
351
|
)}
|
|
352
|
+
{/* Google pay, Apple pay */}
|
|
353
|
+
{methodsPay.includes(isOpenMethod?.paymethod?.gateway) && (
|
|
354
|
+
<StripeElementsForm
|
|
355
|
+
cart={cart}
|
|
356
|
+
paymethod={isOpenMethod?.paymethod?.gateway}
|
|
357
|
+
methodsPay={methodsPay}
|
|
358
|
+
businessId={props.businessId}
|
|
359
|
+
publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
|
|
360
|
+
handleSource={handlePaymethodDataChange}
|
|
361
|
+
onCancel={() => handlePaymethodClick(null)}
|
|
362
|
+
merchantId={merchantId}
|
|
363
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
364
|
+
methodPaySupported={methodPaySupported}
|
|
365
|
+
placeByMethodPay={placeByMethodPay}
|
|
366
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
367
|
+
/>
|
|
368
|
+
)}
|
|
298
369
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
onSelectCard={handlePaymethodDataChange}
|
|
317
|
-
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
318
|
-
/>
|
|
319
|
-
</KeyboardAvoidingView>
|
|
320
|
-
</OModal>
|
|
370
|
+
{(cardsPaymethods.includes(isOpenMethod?.paymethod?.gateway) || cardsPaymethods.includes(paymethodSelected?.gateway)) && (
|
|
371
|
+
<PaymentOptionCard
|
|
372
|
+
setCardList={setCardList}
|
|
373
|
+
paymethod={isOpenMethod?.paymethod}
|
|
374
|
+
businessId={props.businessId}
|
|
375
|
+
publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
|
|
376
|
+
gateway={isOpenMethod?.paymethod?.gateway || paymethodSelected?.gateway}
|
|
377
|
+
onPaymentChange={onPaymentChange}
|
|
378
|
+
payType={isOpenMethod?.paymethod?.name}
|
|
379
|
+
onSelectCard={handlePaymethodDataChange}
|
|
380
|
+
addCardOpen={addCardOpen}
|
|
381
|
+
setAddCardOpen={setAddCardOpen}
|
|
382
|
+
onCancel={() => handlePaymethodClick(null)}
|
|
383
|
+
paymethodSelected={paymethodSelected?.data?.id}
|
|
384
|
+
handlePaymentMethodClick={handlePaymentMethodClick}
|
|
385
|
+
/>
|
|
386
|
+
)}
|
|
321
387
|
|
|
322
|
-
{/* Stripe direct
|
|
388
|
+
{/* Stripe direct */}
|
|
323
389
|
<OModal
|
|
324
390
|
entireModal
|
|
325
391
|
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
@@ -367,7 +433,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
367
433
|
/>
|
|
368
434
|
</View>
|
|
369
435
|
)}
|
|
370
|
-
|
|
436
|
+
{/** Stripe connect add cards */}
|
|
371
437
|
<OModal
|
|
372
438
|
entireModal
|
|
373
439
|
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
@@ -7,7 +7,7 @@ import { Wrapper } from './styles'
|
|
|
7
7
|
|
|
8
8
|
import { PhoneInputParams } from '../../types';
|
|
9
9
|
import { OIcon, OText } from '../shared';
|
|
10
|
-
import { transformCountryCode } from '../../utils'
|
|
10
|
+
import { findExitingCode, transformCountryCode } from '../../utils'
|
|
11
11
|
|
|
12
12
|
export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
13
13
|
const {
|
|
@@ -24,7 +24,8 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
24
24
|
noDropIcon,
|
|
25
25
|
isDisabled,
|
|
26
26
|
isStartValidation,
|
|
27
|
-
changeCountry
|
|
27
|
+
changeCountry,
|
|
28
|
+
updateStateWithSubmit
|
|
28
29
|
} = props
|
|
29
30
|
|
|
30
31
|
const theme = useTheme();
|
|
@@ -95,6 +96,19 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
95
96
|
}
|
|
96
97
|
}, [userphoneNumber])
|
|
97
98
|
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (defaultValue && updateStateWithSubmit) {
|
|
101
|
+
phoneInput.current?.setState({
|
|
102
|
+
number: defaultValue,
|
|
103
|
+
countryCode: defaultCode ?
|
|
104
|
+
!isNaN(defaultCode)
|
|
105
|
+
? transformCountryCode(defaultCode)
|
|
106
|
+
: findExitingCode(defaultCode)
|
|
107
|
+
: findExitingCode(configs?.default_country_code?.value?.toUpperCase())
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
}, [defaultValue])
|
|
111
|
+
|
|
98
112
|
return (
|
|
99
113
|
<Wrapper onPress={() => forwardRef?.current?.focus?.()}>
|
|
100
114
|
{(isStartValidation && userphoneNumber === '') && (
|
|
@@ -112,8 +126,8 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
112
126
|
defaultCode={defaultCode ?
|
|
113
127
|
!isNaN(defaultCode)
|
|
114
128
|
? transformCountryCode(defaultCode)
|
|
115
|
-
: defaultCode
|
|
116
|
-
: configs?.default_country_code?.value}
|
|
129
|
+
: findExitingCode(defaultCode)
|
|
130
|
+
: findExitingCode(configs?.default_country_code?.value?.toUpperCase())}
|
|
117
131
|
onChangeFormattedText={(text: string) => handleChangeNumber(text)}
|
|
118
132
|
withDarkTheme
|
|
119
133
|
onChangeCountry={(country) => changeCountry?.(country)}
|
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
I18nManager,
|
|
10
10
|
SafeAreaView,
|
|
11
11
|
Platform,
|
|
12
|
-
Button
|
|
13
|
-
Vibration
|
|
12
|
+
Button
|
|
14
13
|
} from 'react-native';
|
|
15
14
|
import {
|
|
16
15
|
ProductForm as ProductOptions,
|
|
@@ -19,8 +18,11 @@ import {
|
|
|
19
18
|
useOrder,
|
|
20
19
|
useUtils,
|
|
21
20
|
ToastType,
|
|
22
|
-
useToast
|
|
21
|
+
useToast,
|
|
22
|
+
useConfig,
|
|
23
|
+
useEvent
|
|
23
24
|
} from 'ordering-components/native';
|
|
25
|
+
import uuid from 'react-native-uuid';
|
|
24
26
|
import { useTheme } from 'styled-components/native';
|
|
25
27
|
import { ProductIngredient } from '../ProductIngredient';
|
|
26
28
|
import { ProductOption } from '../ProductOption';
|
|
@@ -28,6 +30,7 @@ import Swiper from 'react-native-swiper'
|
|
|
28
30
|
import FastImage from 'react-native-fast-image';
|
|
29
31
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
30
32
|
import YoutubePlayer from "react-native-youtube-iframe"
|
|
33
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
31
34
|
|
|
32
35
|
import {
|
|
33
36
|
WrapHeader,
|
|
@@ -52,6 +55,7 @@ import { ProductOptionSubOption } from '../ProductOptionSubOption';
|
|
|
52
55
|
import { NotFoundSource } from '../NotFoundSource';
|
|
53
56
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
54
57
|
import NavBar from '../NavBar';
|
|
58
|
+
import { orderTypeList, vibrateApp } from '../../utils';
|
|
55
59
|
const windowWidth = Dimensions.get('window').width;
|
|
56
60
|
|
|
57
61
|
export const ProductOptionsUI = (props: any) => {
|
|
@@ -71,13 +75,16 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
71
75
|
handleChangeSuboptionState,
|
|
72
76
|
handleChangeCommentState,
|
|
73
77
|
productObject,
|
|
74
|
-
productAddedToCartLength
|
|
78
|
+
productAddedToCartLength,
|
|
79
|
+
actionStatus,
|
|
80
|
+
handleCreateGuestUser
|
|
75
81
|
} = props;
|
|
76
82
|
|
|
77
83
|
const theme = useTheme();
|
|
78
84
|
const [, { showToast }] = useToast()
|
|
85
|
+
const [events] = useEvent()
|
|
79
86
|
|
|
80
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
87
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
81
88
|
|
|
82
89
|
const styles = StyleSheet.create({
|
|
83
90
|
mainContainer: {
|
|
@@ -130,7 +137,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
130
137
|
},
|
|
131
138
|
slide1: {
|
|
132
139
|
flex: 1,
|
|
133
|
-
alignItems: 'center'
|
|
140
|
+
alignItems: 'center',
|
|
141
|
+
width: '100%',
|
|
134
142
|
},
|
|
135
143
|
mainSwiper: {
|
|
136
144
|
height: 258,
|
|
@@ -169,7 +177,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
169
177
|
marginTop: 10
|
|
170
178
|
},
|
|
171
179
|
wrapperNavbar: {
|
|
172
|
-
paddingHorizontal:
|
|
180
|
+
paddingHorizontal: 30,
|
|
173
181
|
paddingTop: 0,
|
|
174
182
|
}
|
|
175
183
|
});
|
|
@@ -178,6 +186,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
178
186
|
const [, t] = useLanguage();
|
|
179
187
|
const [orderState] = useOrder();
|
|
180
188
|
const [{ auth }] = useSession();
|
|
189
|
+
const [{ configs }] = useConfig()
|
|
181
190
|
const { product, loading, error } = productObject;
|
|
182
191
|
const [gallery, setGallery] = useState([])
|
|
183
192
|
const [thumbsSwiper, setThumbsSwiper] = useState(0)
|
|
@@ -197,6 +206,19 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
197
206
|
const [summaryRefHeight, setSummaryRefHeight] = useState(0)
|
|
198
207
|
const [isScrollAvailable, setIsScrollAvailable] = useState(null)
|
|
199
208
|
const [editionsLayoutY, setEditionsLayoutY] = useState(null)
|
|
209
|
+
const [viewedProduct, setViewedProduct] = useState<any>(null)
|
|
210
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
211
|
+
|
|
212
|
+
const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
|
|
213
|
+
const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
|
|
214
|
+
|
|
215
|
+
const vibrateApp = (impact?: string) => {
|
|
216
|
+
const options = {
|
|
217
|
+
enableVibrateFallback: true,
|
|
218
|
+
ignoreAndroidSystemSettings: false
|
|
219
|
+
};
|
|
220
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
221
|
+
}
|
|
200
222
|
|
|
201
223
|
const isError = (id: number) => {
|
|
202
224
|
let bgColor = theme.colors.white;
|
|
@@ -213,7 +235,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
213
235
|
};
|
|
214
236
|
|
|
215
237
|
const handleSaveProduct = () => {
|
|
216
|
-
|
|
238
|
+
vibrateApp()
|
|
217
239
|
if (!productCart.quantity) {
|
|
218
240
|
showToast(ToastType.Error, t('VALIDATION_ERROR_REQUIRED', 'The quantity field is required').replace('_attribute_', t('PRODUCT_POTIONS_QUANTITY', 'Quantity')))
|
|
219
241
|
return
|
|
@@ -294,6 +316,11 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
294
316
|
}
|
|
295
317
|
}
|
|
296
318
|
|
|
319
|
+
const handleUpdateGuest = () => {
|
|
320
|
+
const guestToken = uuid.v4()
|
|
321
|
+
if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
|
|
322
|
+
}
|
|
323
|
+
|
|
297
324
|
const handleOnLayout = (event: any, optionId: any) => {
|
|
298
325
|
const _optionLayout = { ...optionLayout }
|
|
299
326
|
const optionKey = 'id:' + optionId
|
|
@@ -345,12 +372,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
345
372
|
</>
|
|
346
373
|
);
|
|
347
374
|
|
|
348
|
-
const handleScroll = ({ nativeEvent: { contentOffset
|
|
349
|
-
|
|
350
|
-
const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
|
|
351
|
-
if (_topOption) {
|
|
352
|
-
const _topOptionId = Number(_topOption.replace('id:', ''))
|
|
353
|
-
}
|
|
375
|
+
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
376
|
+
setShowTitle(contentOffset.y > 30)
|
|
354
377
|
}
|
|
355
378
|
|
|
356
379
|
const handleGoBack = navigation?.canGoBack()
|
|
@@ -467,14 +490,27 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
467
490
|
: t('LOGIN_SIGNUP', 'Login / Sign Up')
|
|
468
491
|
}
|
|
469
492
|
imgRightSrc=""
|
|
470
|
-
textStyle={{ color: theme.colors.primary, fontSize:
|
|
493
|
+
textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
|
|
471
494
|
style={{
|
|
472
|
-
height:
|
|
495
|
+
height: 42,
|
|
473
496
|
borderColor: theme.colors.primary,
|
|
474
497
|
backgroundColor: theme.colors.white,
|
|
498
|
+
paddingLeft: 0,
|
|
499
|
+
paddingRight: 0
|
|
475
500
|
}}
|
|
476
501
|
/>
|
|
477
502
|
)}
|
|
503
|
+
{!auth && guestCheckoutEnabled && orderTypeEnabled && (
|
|
504
|
+
<TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
|
|
505
|
+
{actionStatus?.loading ? (
|
|
506
|
+
<Placeholder Animation={Fade}>
|
|
507
|
+
<PlaceholderLine height={20} />
|
|
508
|
+
</Placeholder>
|
|
509
|
+
) : (
|
|
510
|
+
<OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('AS_GUEST_USER', 'As guest user')}</OText>
|
|
511
|
+
)}
|
|
512
|
+
</TouchableOpacity>
|
|
513
|
+
)}
|
|
478
514
|
</View>
|
|
479
515
|
)
|
|
480
516
|
}
|
|
@@ -488,21 +524,43 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
488
524
|
}
|
|
489
525
|
}, [])
|
|
490
526
|
|
|
527
|
+
useEffect(() => {
|
|
528
|
+
if (!product?.id || product?.id === viewedProduct?.id) return
|
|
529
|
+
setViewedProduct(product)
|
|
530
|
+
events.emit('product_viewed', product)
|
|
531
|
+
}, [product?.id, viewedProduct])
|
|
532
|
+
|
|
491
533
|
return (
|
|
492
534
|
<SafeAreaView style={{ flex: 1 }}>
|
|
493
535
|
<View style={styles.wrapperNavbar}>
|
|
494
|
-
<
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
536
|
+
<TopHeader>
|
|
537
|
+
<>
|
|
538
|
+
<TopActions onPress={() => handleGoBack()}>
|
|
539
|
+
<IconAntDesign
|
|
540
|
+
name='arrowleft'
|
|
541
|
+
size={26}
|
|
542
|
+
/>
|
|
543
|
+
</TopActions>
|
|
544
|
+
{showTitle && (
|
|
545
|
+
<OText
|
|
546
|
+
size={16}
|
|
547
|
+
style={{ flex: 1, textAlign: 'center' }}
|
|
548
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
549
|
+
numberOfLines={2}
|
|
550
|
+
ellipsizeMode='tail'
|
|
551
|
+
>
|
|
552
|
+
{product?.name}
|
|
553
|
+
</OText>
|
|
554
|
+
)}
|
|
555
|
+
</>
|
|
556
|
+
</TopHeader>
|
|
500
557
|
</View>
|
|
501
558
|
{!error && (
|
|
502
559
|
<ScrollView
|
|
503
560
|
ref={scrollViewRef}
|
|
504
561
|
contentContainerStyle={{ paddingBottom: 80 }}
|
|
505
562
|
stickyHeaderIndices={[2]}
|
|
563
|
+
scrollEventThrottle={100}
|
|
506
564
|
onScroll={handleScroll}
|
|
507
565
|
>
|
|
508
566
|
<WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
|
|
@@ -630,7 +688,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
630
688
|
)}
|
|
631
689
|
</WrapHeader>
|
|
632
690
|
<ProductSummary
|
|
633
|
-
ph={isChewLayout ? 20 :
|
|
691
|
+
ph={isChewLayout ? 20 : 30}
|
|
634
692
|
onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
|
|
635
693
|
>
|
|
636
694
|
<ProductTitle>
|
|
@@ -700,6 +758,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
700
758
|
</ProductDescription>
|
|
701
759
|
<ScrollView
|
|
702
760
|
horizontal
|
|
761
|
+
scrollEventThrottle={100}
|
|
703
762
|
showsHorizontalScrollIndicator={false}
|
|
704
763
|
contentContainerStyle={{ paddingBottom: 30 }}
|
|
705
764
|
>
|
|
@@ -727,12 +786,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
727
786
|
{(!loading && product) && (
|
|
728
787
|
<ExtraOptionWrap
|
|
729
788
|
horizontal
|
|
789
|
+
scrollEventThrottle={100}
|
|
730
790
|
showsHorizontalScrollIndicator={false}
|
|
731
791
|
style={{
|
|
732
792
|
marginBottom: 20,
|
|
733
793
|
borderBottomWidth: 1,
|
|
734
794
|
borderBottomColor: theme.colors.border,
|
|
735
|
-
marginHorizontal:
|
|
795
|
+
marginHorizontal: 20,
|
|
736
796
|
backgroundColor: theme.colors.backgroundPage,
|
|
737
797
|
}}
|
|
738
798
|
>
|
|
@@ -806,7 +866,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
806
866
|
</>
|
|
807
867
|
) : (
|
|
808
868
|
<ProductEditions
|
|
809
|
-
style={{ paddingHorizontal: isChewLayout ? 20 :
|
|
869
|
+
style={{ paddingHorizontal: isChewLayout ? 20 : 30 }}
|
|
810
870
|
onLayout={(event: any) => {
|
|
811
871
|
setEditionsLayoutY(event.nativeEvent.layout?.y)
|
|
812
872
|
}}
|
|
@@ -853,12 +913,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
853
913
|
}}>
|
|
854
914
|
{option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
|
|
855
915
|
(suboption: any) => {
|
|
856
|
-
const currentState =
|
|
857
|
-
productCart.options[
|
|
858
|
-
`id:${option.id}`
|
|
859
|
-
]?.suboptions[
|
|
860
|
-
`id:${suboption.id}`
|
|
861
|
-
] || {};
|
|
916
|
+
const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {};
|
|
862
917
|
const balance =
|
|
863
918
|
productCart.options[
|
|
864
919
|
`id:${option.id}`
|
|
@@ -873,6 +928,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
873
928
|
balance={balance}
|
|
874
929
|
option={option}
|
|
875
930
|
suboption={suboption}
|
|
931
|
+
image={suboption.image}
|
|
876
932
|
state={currentState}
|
|
877
933
|
disabled={
|
|
878
934
|
isSoldOut ||
|
|
@@ -8,8 +8,8 @@ export const WrapHeader = styled.View`
|
|
|
8
8
|
export const TopActions = styled.TouchableOpacity`
|
|
9
9
|
height: 60px;
|
|
10
10
|
justify-content: center;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
min-width: 30px;
|
|
12
|
+
padding-right: 15px;
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
15
|
export const TopHeader = styled.View`
|
|
@@ -70,7 +70,7 @@ export const ProductActions = styled.View`
|
|
|
70
70
|
position: absolute;
|
|
71
71
|
bottom: 0px;
|
|
72
72
|
padding-top: ${(props: any) => props.ios ? '20px' : '0'};
|
|
73
|
-
padding-horizontal:
|
|
73
|
+
padding-horizontal: 30px;
|
|
74
74
|
padding-vertical: 20px;
|
|
75
75
|
width: 100%;
|
|
76
76
|
flex-direction: ${(props: any) => props.isColumn ? 'column' : 'row'};
|
|
@@ -77,6 +77,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
77
77
|
const [isServiceOpen, setIsServiceOpen] = useState(false)
|
|
78
78
|
// const [setHeight, setHeightState] = useState({ height: new Animated.Value(0) })
|
|
79
79
|
// const [setRotate, setRotateState] = useState({ angle: new Animated.Value(0) })
|
|
80
|
+
const [productQuantity, setProductQuantity] = useState(product.quantity.toString())
|
|
80
81
|
|
|
81
82
|
const productInfo = () => {
|
|
82
83
|
if (isCartProduct) {
|
|
@@ -107,19 +108,20 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
107
108
|
/* const toggleAccordion = () => {
|
|
108
109
|
if ((!product?.valid_menu && isCartProduct)) return
|
|
109
110
|
if (isActive) {
|
|
110
|
-
|
|
111
|
+
Animated.timing(setHeight.height, {
|
|
111
112
|
toValue: 100,
|
|
112
113
|
duration: 500,
|
|
113
114
|
easing: Easing.linear,
|
|
114
115
|
useNativeDriver: false,
|
|
115
|
-
|
|
116
|
+
}).start()
|
|
116
117
|
} else {
|
|
117
|
-
|
|
118
|
+
setHeightState({height: new Animated.Value(0)})
|
|
118
119
|
}
|
|
119
120
|
}*/
|
|
120
121
|
|
|
121
122
|
const handleChangeQuantity = (value: string) => {
|
|
122
123
|
if (!orderState.loading) {
|
|
124
|
+
setProductQuantity(value)
|
|
123
125
|
if (parseInt(value) === 0) {
|
|
124
126
|
onDeleteProduct && onDeleteProduct(product)
|
|
125
127
|
} else {
|
|
@@ -134,7 +136,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
/*useEffect(() => {
|
|
137
|
-
|
|
139
|
+
toggleAccordion()
|
|
138
140
|
}, [isActive])*/
|
|
139
141
|
|
|
140
142
|
const productOptions = getProductMax && [...Array(getProductMax(product) + 1),].map((_: any, opt: number) => {
|
|
@@ -209,7 +211,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
209
211
|
<RNPickerSelect
|
|
210
212
|
items={productOptions}
|
|
211
213
|
onValueChange={handleChangeQuantity}
|
|
212
|
-
value={
|
|
214
|
+
value={productQuantity}
|
|
213
215
|
style={pickerStyle}
|
|
214
216
|
useNativeAndroidPickerStyle={false}
|
|
215
217
|
placeholder={{}}
|
|
@@ -287,7 +289,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
287
289
|
)}
|
|
288
290
|
{productInfo().options.length > 0 && (
|
|
289
291
|
<ProductOptionsList>
|
|
290
|
-
{productInfo().options.map((option: any, i: number) => (
|
|
292
|
+
{productInfo().options.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => (
|
|
291
293
|
<ProductOption key={option.id + i}>
|
|
292
294
|
<OText size={10} color={theme.colors.textSecondary}>{option.name}</OText>
|
|
293
295
|
{option.suboptions.map((suboption: any) => (
|