ordering-ui-react-native 0.17.38 → 0.17.39-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/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/StripeMethodForm/index.tsx +135 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +7 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +118 -107
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
- package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/business/src/components/LoginForm/index.tsx +238 -80
- package/themes/business/src/components/LoginForm/styles.tsx +10 -0
- package/themes/business/src/components/MapView/index.tsx +10 -10
- package/themes/business/src/components/NewOrderNotification/index.tsx +43 -50
- package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +90 -47
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +18 -17
- package/themes/business/src/components/OrderSummary/index.tsx +113 -121
- package/themes/business/src/components/OrdersOption/index.tsx +32 -75
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
- package/themes/business/src/components/ReviewCustomer/index.tsx +41 -24
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/shared/OLink.tsx +33 -13
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/components/shared/OText.tsx +8 -2
- package/themes/business/src/types/index.tsx +32 -2
- package/themes/business/src/utils/index.tsx +44 -1
- 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/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
- package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
- package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
- 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 +3 -2
- package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
- package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
- package/themes/kiosk/src/layouts/Container.tsx +7 -1
- package/themes/kiosk/src/types/index.d.ts +13 -0
- package/themes/kiosk/src/utils/index.tsx +15 -0
- package/themes/original/index.tsx +6 -0
- package/themes/original/src/components/AddressDetails/index.tsx +29 -11
- package/themes/original/src/components/AddressForm/index.tsx +79 -44
- package/themes/original/src/components/AddressList/index.tsx +26 -21
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- 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/BusinessBasicInformation/index.tsx +159 -90
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
- package/themes/original/src/components/BusinessController/index.tsx +154 -68
- package/themes/original/src/components/BusinessController/styles.tsx +22 -9
- 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 +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
- package/themes/original/src/components/BusinessListingSearch/index.tsx +351 -326
- package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
- package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
- 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 +684 -524
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -6
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +106 -79
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +102 -69
- package/themes/original/src/components/CartContent/index.tsx +115 -19
- package/themes/original/src/components/CartContent/styles.tsx +17 -7
- package/themes/original/src/components/Checkout/index.tsx +375 -179
- package/themes/original/src/components/Checkout/styles.tsx +4 -2
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- 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/Favorite/index.tsx +7 -4
- package/themes/original/src/components/Favorite/styles.tsx +1 -1
- package/themes/original/src/components/FavoriteList/index.tsx +51 -80
- package/themes/original/src/components/FloatingButton/index.tsx +1 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
- package/themes/original/src/components/GoogleMap/index.tsx +15 -4
- package/themes/original/src/components/Help/index.tsx +8 -8
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
- package/themes/original/src/components/HelpGuide/index.tsx +12 -16
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +12 -25
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/LoginForm/Otp/index.tsx +139 -75
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +71 -28
- package/themes/original/src/components/LottieAnimation/index.tsx +103 -0
- package/themes/original/src/components/MessageListing/index.tsx +16 -42
- package/themes/original/src/components/Messages/index.tsx +32 -10
- package/themes/original/src/components/MomentOption/index.tsx +195 -88
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +219 -117
- package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +53 -51
- package/themes/original/src/components/NavBar/index.tsx +18 -18
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +46 -50
- package/themes/original/src/components/Notifications/styles.tsx +6 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
- package/themes/original/src/components/OrderDetails/index.tsx +199 -359
- 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 +93 -114
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +87 -59
- package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
- package/themes/original/src/components/OrdersOption/index.tsx +70 -65
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +171 -0
- package/themes/original/src/components/PageBanner/styles.tsx +11 -0
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +64 -7
- package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
- package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
- package/themes/original/src/components/ProductForm/index.tsx +223 -232
- package/themes/original/src/components/ProductForm/styles.tsx +5 -8
- package/themes/original/src/components/ProductItemAccordion/index.tsx +29 -28
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +19 -11
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
- 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 +234 -220
- package/themes/original/src/components/Promotions/styles.tsx +10 -3
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
- package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
- package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +74 -19
- package/themes/original/src/components/Sessions/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +42 -19
- package/themes/original/src/components/SingleOrderCard/index.tsx +156 -65
- package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -9
- package/themes/original/src/components/SingleProductCard/index.tsx +100 -56
- package/themes/original/src/components/SingleProductCard/styles.tsx +22 -13
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +28 -15
- package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +8 -4
- package/themes/original/src/components/UserFormDetails/index.tsx +47 -7
- package/themes/original/src/components/UserProfile/index.tsx +5 -7
- package/themes/original/src/components/UserProfileForm/index.tsx +25 -28
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- 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 +79 -36
- package/themes/original/src/components/Wallets/styles.tsx +5 -4
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +6 -2
- package/themes/original/src/components/shared/OInput.tsx +16 -2
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/types/index.tsx +38 -9
- package/themes/original/src/utils/index.tsx +364 -58
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
I18nManager,
|
|
10
10
|
SafeAreaView,
|
|
11
11
|
Platform,
|
|
12
|
-
Button
|
|
12
|
+
Button,
|
|
13
|
+
Vibration
|
|
13
14
|
} from 'react-native';
|
|
14
15
|
import {
|
|
15
16
|
ProductForm as ProductOptions,
|
|
@@ -18,8 +19,11 @@ import {
|
|
|
18
19
|
useOrder,
|
|
19
20
|
useUtils,
|
|
20
21
|
ToastType,
|
|
21
|
-
useToast
|
|
22
|
+
useToast,
|
|
23
|
+
useConfig,
|
|
24
|
+
useEvent
|
|
22
25
|
} from 'ordering-components/native';
|
|
26
|
+
import uuid from 'react-native-uuid';
|
|
23
27
|
import { useTheme } from 'styled-components/native';
|
|
24
28
|
import { ProductIngredient } from '../ProductIngredient';
|
|
25
29
|
import { ProductOption } from '../ProductOption';
|
|
@@ -27,6 +31,7 @@ import Swiper from 'react-native-swiper'
|
|
|
27
31
|
import FastImage from 'react-native-fast-image';
|
|
28
32
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
29
33
|
import YoutubePlayer from "react-native-youtube-iframe"
|
|
34
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
30
35
|
|
|
31
36
|
import {
|
|
32
37
|
WrapHeader,
|
|
@@ -50,6 +55,8 @@ import { ScrollView } from 'react-native-gesture-handler';
|
|
|
50
55
|
import { ProductOptionSubOption } from '../ProductOptionSubOption';
|
|
51
56
|
import { NotFoundSource } from '../NotFoundSource';
|
|
52
57
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
58
|
+
import NavBar from '../NavBar';
|
|
59
|
+
import { orderTypeList } from '../../utils';
|
|
53
60
|
const windowWidth = Dimensions.get('window').width;
|
|
54
61
|
|
|
55
62
|
export const ProductOptionsUI = (props: any) => {
|
|
@@ -69,11 +76,16 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
69
76
|
handleChangeSuboptionState,
|
|
70
77
|
handleChangeCommentState,
|
|
71
78
|
productObject,
|
|
72
|
-
productAddedToCartLength
|
|
79
|
+
productAddedToCartLength,
|
|
80
|
+
actionStatus,
|
|
81
|
+
handleCreateGuestUser
|
|
73
82
|
} = props;
|
|
74
83
|
|
|
75
84
|
const theme = useTheme();
|
|
76
85
|
const [, { showToast }] = useToast()
|
|
86
|
+
const [events] = useEvent()
|
|
87
|
+
|
|
88
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
77
89
|
|
|
78
90
|
const styles = StyleSheet.create({
|
|
79
91
|
mainContainer: {
|
|
@@ -126,6 +138,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
126
138
|
},
|
|
127
139
|
slide1: {
|
|
128
140
|
flex: 1,
|
|
141
|
+
alignItems: 'center'
|
|
129
142
|
},
|
|
130
143
|
mainSwiper: {
|
|
131
144
|
height: 258,
|
|
@@ -162,6 +175,10 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
162
175
|
justifyContent: 'space-between',
|
|
163
176
|
width: '100%',
|
|
164
177
|
marginTop: 10
|
|
178
|
+
},
|
|
179
|
+
wrapperNavbar: {
|
|
180
|
+
paddingHorizontal: 40,
|
|
181
|
+
paddingTop: 0,
|
|
165
182
|
}
|
|
166
183
|
});
|
|
167
184
|
|
|
@@ -169,6 +186,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
169
186
|
const [, t] = useLanguage();
|
|
170
187
|
const [orderState] = useOrder();
|
|
171
188
|
const [{ auth }] = useSession();
|
|
189
|
+
const [{ configs }] = useConfig()
|
|
172
190
|
const { product, loading, error } = productObject;
|
|
173
191
|
const [gallery, setGallery] = useState([])
|
|
174
192
|
const [thumbsSwiper, setThumbsSwiper] = useState(0)
|
|
@@ -187,6 +205,20 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
187
205
|
const [headerRefHeight, setHeaderRefHeight] = useState(0)
|
|
188
206
|
const [summaryRefHeight, setSummaryRefHeight] = useState(0)
|
|
189
207
|
const [isScrollAvailable, setIsScrollAvailable] = useState(null)
|
|
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
|
+
}
|
|
190
222
|
|
|
191
223
|
const isError = (id: number) => {
|
|
192
224
|
let bgColor = theme.colors.white;
|
|
@@ -203,11 +235,12 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
203
235
|
};
|
|
204
236
|
|
|
205
237
|
const handleSaveProduct = () => {
|
|
238
|
+
Vibration.vibrate()
|
|
206
239
|
if (!productCart.quantity) {
|
|
207
240
|
showToast(ToastType.Error, t('VALIDATION_ERROR_REQUIRED', 'The quantity field is required').replace('_attribute_', t('PRODUCT_POTIONS_QUANTITY', 'Quantity')))
|
|
208
241
|
return
|
|
209
242
|
}
|
|
210
|
-
const isErrors = Object.values(errors)
|
|
243
|
+
const isErrors = Object.values(errors)?.length > 0;
|
|
211
244
|
if (!isErrors) {
|
|
212
245
|
handleSave && handleSave();
|
|
213
246
|
return;
|
|
@@ -226,7 +259,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
226
259
|
};
|
|
227
260
|
|
|
228
261
|
const handleChangeMainIndex = (index: number) => {
|
|
229
|
-
if (index < 0 || index > gallery
|
|
262
|
+
if (index < 0 || index > gallery?.length - 1) {
|
|
230
263
|
setThumbsSwiper(0)
|
|
231
264
|
return
|
|
232
265
|
}
|
|
@@ -269,7 +302,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
269
302
|
}
|
|
270
303
|
|
|
271
304
|
const scrollDown = (id: any) => {
|
|
272
|
-
const isErrors = Object.values(errors)
|
|
305
|
+
const isErrors = Object.values(errors)?.length > 0
|
|
273
306
|
if (!isErrors) {
|
|
274
307
|
return
|
|
275
308
|
}
|
|
@@ -283,6 +316,11 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
283
316
|
}
|
|
284
317
|
}
|
|
285
318
|
|
|
319
|
+
const handleUpdateGuest = () => {
|
|
320
|
+
const guestToken = uuid.v4()
|
|
321
|
+
if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
|
|
322
|
+
}
|
|
323
|
+
|
|
286
324
|
const handleOnLayout = (event: any, optionId: any) => {
|
|
287
325
|
const _optionLayout = { ...optionLayout }
|
|
288
326
|
const optionKey = 'id:' + optionId
|
|
@@ -293,7 +331,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
293
331
|
const saveErrors =
|
|
294
332
|
orderState.loading ||
|
|
295
333
|
maxProductQuantity === 0 ||
|
|
296
|
-
Object.keys(errors)
|
|
334
|
+
Object.keys(errors)?.length > 0;
|
|
335
|
+
|
|
297
336
|
|
|
298
337
|
const ExtraOptions = ({ eID, options }: any) => (
|
|
299
338
|
<>
|
|
@@ -302,19 +341,25 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
302
341
|
{respect_to == null && suboptions?.length > 0 && (
|
|
303
342
|
<TouchableOpacity
|
|
304
343
|
key={`eopt_key_${id}`}
|
|
305
|
-
onPress={() =>
|
|
344
|
+
onPress={() => {
|
|
345
|
+
setSelectedOpt(id)
|
|
346
|
+
scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
|
|
347
|
+
y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
|
|
348
|
+
animated: true
|
|
349
|
+
})
|
|
350
|
+
}}
|
|
306
351
|
style={[
|
|
307
352
|
styles.extraItem,
|
|
308
353
|
{
|
|
309
354
|
borderBottomColor:
|
|
310
|
-
selOpt == id ? theme.colors.textNormal : theme.colors.
|
|
355
|
+
selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
|
|
311
356
|
},
|
|
312
357
|
]}>
|
|
313
358
|
<OText
|
|
314
359
|
color={
|
|
315
360
|
selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
|
|
316
361
|
}
|
|
317
|
-
size={
|
|
362
|
+
size={12}
|
|
318
363
|
weight={selOpt == id ? '600' : 'normal'}
|
|
319
364
|
style={{ maxWidth: 150 }}
|
|
320
365
|
numberOfLines={1}>
|
|
@@ -328,7 +373,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
328
373
|
);
|
|
329
374
|
|
|
330
375
|
const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
|
|
331
|
-
|
|
376
|
+
setShowTitle(contentOffset.y > 30)
|
|
332
377
|
const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
|
|
333
378
|
if (_topOption) {
|
|
334
379
|
const _topOptionId = Number(_topOption.replace('id:', ''))
|
|
@@ -349,15 +394,18 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
349
394
|
useEffect(() => {
|
|
350
395
|
const imageList: any = []
|
|
351
396
|
const videoList: any = []
|
|
352
|
-
product?.images?.length > 0
|
|
353
|
-
|
|
397
|
+
imageList.push(product?.images?.length > 0
|
|
398
|
+
? product.images
|
|
399
|
+
: theme?.images?.dummies?.product)
|
|
400
|
+
|
|
401
|
+
if (product?.gallery && product?.gallery?.length > 0) {
|
|
354
402
|
for (const img of product?.gallery) {
|
|
355
403
|
if (img?.file) {
|
|
356
404
|
imageList.push(img?.file)
|
|
357
405
|
}
|
|
358
406
|
if (img?.video) {
|
|
359
407
|
const keys = img?.video.split('/')
|
|
360
|
-
let _videoId = keys[keys
|
|
408
|
+
let _videoId = keys[keys?.length - 1]
|
|
361
409
|
|
|
362
410
|
if (_videoId.includes('watch')) {
|
|
363
411
|
const __url = _videoId.split('=')[1]
|
|
@@ -372,7 +420,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
372
420
|
} else if (_videoId.search(/\?/i) >= 0) {
|
|
373
421
|
_videoId = _videoId.split('?')[0]
|
|
374
422
|
}
|
|
375
|
-
if ((_videoId
|
|
423
|
+
if ((_videoId?.length === 11)) {
|
|
376
424
|
videoList.push(_videoId)
|
|
377
425
|
}
|
|
378
426
|
}
|
|
@@ -451,9 +499,22 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
451
499
|
height: 44,
|
|
452
500
|
borderColor: theme.colors.primary,
|
|
453
501
|
backgroundColor: theme.colors.white,
|
|
502
|
+
paddingLeft: 0,
|
|
503
|
+
paddingRight: 0
|
|
454
504
|
}}
|
|
455
505
|
/>
|
|
456
506
|
)}
|
|
507
|
+
{!auth && guestCheckoutEnabled && orderTypeEnabled && (
|
|
508
|
+
<TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
|
|
509
|
+
{actionStatus?.loading ? (
|
|
510
|
+
<Placeholder Animation={Fade}>
|
|
511
|
+
<PlaceholderLine width={60} height={20} />
|
|
512
|
+
</Placeholder>
|
|
513
|
+
) : (
|
|
514
|
+
<OText color={theme.colors.primary} size={13}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
|
|
515
|
+
)}
|
|
516
|
+
</TouchableOpacity>
|
|
517
|
+
)}
|
|
457
518
|
</View>
|
|
458
519
|
)
|
|
459
520
|
}
|
|
@@ -467,14 +528,34 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
467
528
|
}
|
|
468
529
|
}, [])
|
|
469
530
|
|
|
531
|
+
useEffect(() => {
|
|
532
|
+
if (!product?.id || product?.id === viewedProduct?.id) return
|
|
533
|
+
setViewedProduct(product)
|
|
534
|
+
events.emit('product_viewed', product)
|
|
535
|
+
}, [product?.id, viewedProduct])
|
|
470
536
|
|
|
471
537
|
return (
|
|
472
538
|
<SafeAreaView style={{ flex: 1 }}>
|
|
473
|
-
<
|
|
474
|
-
<
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
539
|
+
<View style={styles.wrapperNavbar}>
|
|
540
|
+
<TopHeader>
|
|
541
|
+
<>
|
|
542
|
+
<TopActions onPress={() => handleGoBack()}>
|
|
543
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
544
|
+
</TopActions>
|
|
545
|
+
{showTitle && (
|
|
546
|
+
<OText
|
|
547
|
+
size={16}
|
|
548
|
+
style={{ flex: 1, textAlign: 'center' }}
|
|
549
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
550
|
+
numberOfLines={2}
|
|
551
|
+
ellipsizeMode='tail'
|
|
552
|
+
>
|
|
553
|
+
{product?.name}
|
|
554
|
+
</OText>
|
|
555
|
+
)}
|
|
556
|
+
</>
|
|
557
|
+
</TopHeader>
|
|
558
|
+
</View>
|
|
478
559
|
{!error && (
|
|
479
560
|
<ScrollView
|
|
480
561
|
ref={scrollViewRef}
|
|
@@ -523,14 +604,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
523
604
|
</View>
|
|
524
605
|
}
|
|
525
606
|
>
|
|
526
|
-
{gallery && gallery
|
|
607
|
+
{gallery && gallery?.length > 0 && gallery.map((img, i) => (
|
|
527
608
|
<View
|
|
528
609
|
style={styles.slide1}
|
|
529
610
|
key={i}
|
|
530
611
|
>
|
|
531
|
-
{String(img).includes('
|
|
612
|
+
{(String(img).includes('http') || typeof img === 'number') ? (
|
|
532
613
|
<FastImage
|
|
533
|
-
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio:
|
|
614
|
+
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
|
|
534
615
|
source={typeof img !== 'number' ? {
|
|
535
616
|
uri: optimizeImage(img, 'h_1024,c_limit'),
|
|
536
617
|
priority: FastImage.priority.normal,
|
|
@@ -539,7 +620,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
539
620
|
) : (
|
|
540
621
|
<>
|
|
541
622
|
<YoutubePlayer
|
|
542
|
-
height={
|
|
623
|
+
height={'100%'}
|
|
624
|
+
width={'100%'}
|
|
543
625
|
play={playing}
|
|
544
626
|
videoId={img}
|
|
545
627
|
onChangeState={onStateChange}
|
|
@@ -557,7 +639,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
557
639
|
paddingVertical: 15
|
|
558
640
|
}}
|
|
559
641
|
>
|
|
560
|
-
{gallery
|
|
642
|
+
{gallery?.length > 1 && gallery.map((img, index) => (
|
|
561
643
|
<TouchableOpacity
|
|
562
644
|
key={index}
|
|
563
645
|
onPress={() => handleClickThumb(index)}
|
|
@@ -570,7 +652,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
570
652
|
opacity: index === thumbsSwiper ? 1 : 0.8
|
|
571
653
|
}}
|
|
572
654
|
>
|
|
573
|
-
{String(img).includes('
|
|
655
|
+
{String(img).includes('http') ? (
|
|
574
656
|
<OIcon
|
|
575
657
|
url={img}
|
|
576
658
|
style={{
|
|
@@ -585,7 +667,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
585
667
|
/>
|
|
586
668
|
) : (
|
|
587
669
|
<OIcon
|
|
588
|
-
url={'
|
|
670
|
+
url={'https://img.youtube.com/vi/' + img + '/0.jpg'}
|
|
589
671
|
style={{
|
|
590
672
|
borderColor: theme.colors.lightGray,
|
|
591
673
|
borderRadius: 8,
|
|
@@ -605,7 +687,10 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
605
687
|
</>
|
|
606
688
|
)}
|
|
607
689
|
</WrapHeader>
|
|
608
|
-
<ProductSummary
|
|
690
|
+
<ProductSummary
|
|
691
|
+
ph={isChewLayout ? 20 : 40}
|
|
692
|
+
onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
|
|
693
|
+
>
|
|
609
694
|
<ProductTitle>
|
|
610
695
|
{loading && !product ? (
|
|
611
696
|
<Placeholder Animation={Fade}>
|
|
@@ -701,45 +786,40 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
701
786
|
<ExtraOptionWrap
|
|
702
787
|
horizontal
|
|
703
788
|
showsHorizontalScrollIndicator={false}
|
|
704
|
-
style={{
|
|
705
|
-
|
|
789
|
+
style={{
|
|
790
|
+
marginBottom: 20,
|
|
791
|
+
borderBottomWidth: 1,
|
|
792
|
+
borderBottomColor: theme.colors.border,
|
|
793
|
+
marginHorizontal: isChewLayout ? 20 : 30,
|
|
794
|
+
backgroundColor: theme.colors.backgroundPage,
|
|
795
|
+
}}
|
|
706
796
|
>
|
|
707
|
-
|
|
708
|
-
key={`eopt_key_00`}
|
|
709
|
-
onPress={() => setSelectedOpt(-1)}
|
|
710
|
-
style={[
|
|
711
|
-
styles.extraItem,
|
|
712
|
-
{
|
|
713
|
-
borderBottomColor: selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
|
|
714
|
-
},
|
|
715
|
-
]}>
|
|
716
|
-
<OText
|
|
717
|
-
color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
|
|
718
|
-
size={selOpt == -1 ? 14 : 12}
|
|
719
|
-
weight={selOpt == -1 ? '600' : 'normal'}>
|
|
720
|
-
{t('ALL', 'All')}
|
|
721
|
-
</OText>
|
|
722
|
-
</TouchableOpacity>
|
|
723
|
-
{product?.ingredients.length > 0 && (
|
|
797
|
+
{product?.ingredients?.length > 0 && (
|
|
724
798
|
<TouchableOpacity
|
|
725
799
|
key={`eopt_key_01`}
|
|
726
|
-
onPress={() =>
|
|
800
|
+
onPress={() => {
|
|
801
|
+
setSelectedOpt(0)
|
|
802
|
+
scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
|
|
803
|
+
y: optionLayout[`id:0`]?.y + editionsLayoutY - 50,
|
|
804
|
+
animated: true
|
|
805
|
+
})
|
|
806
|
+
}}
|
|
727
807
|
style={[
|
|
728
808
|
styles.extraItem,
|
|
729
809
|
{
|
|
730
810
|
borderBottomColor:
|
|
731
|
-
selOpt == 0 ? theme.colors.textNormal : theme.colors.
|
|
811
|
+
selOpt == 0 ? theme.colors.textNormal : theme.colors.backgroundPage,
|
|
732
812
|
},
|
|
733
813
|
]}>
|
|
734
814
|
<OText
|
|
735
815
|
color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
|
|
736
|
-
size={
|
|
816
|
+
size={12}
|
|
737
817
|
weight={selOpt == 0 ? '600' : 'normal'}>
|
|
738
818
|
{t('INGREDIENTS', 'Ingredients')}
|
|
739
819
|
</OText>
|
|
740
820
|
</TouchableOpacity>
|
|
741
821
|
)}
|
|
742
|
-
{product?.extras
|
|
822
|
+
{product?.extras?.map((extra: any) =>
|
|
743
823
|
<ExtraOptions key={extra.id} options={extra.options} />
|
|
744
824
|
)}
|
|
745
825
|
</ExtraOptionWrap>
|
|
@@ -783,184 +863,94 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
783
863
|
))}
|
|
784
864
|
</>
|
|
785
865
|
) : (
|
|
786
|
-
<ProductEditions
|
|
787
|
-
{
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
<
|
|
797
|
-
{
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
))}
|
|
808
|
-
</WrapperIngredients>
|
|
809
|
-
</View>
|
|
810
|
-
)}
|
|
811
|
-
{product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
|
|
812
|
-
extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
|
|
813
|
-
const currentState =
|
|
814
|
-
productCart.options[`id:${option.id}`] || {};
|
|
815
|
-
return (
|
|
816
|
-
<React.Fragment key={`popt_${option.id}`}>
|
|
817
|
-
{showOption(option) && (
|
|
818
|
-
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
|
|
819
|
-
<ProductOption
|
|
820
|
-
option={option}
|
|
821
|
-
currentState={currentState}
|
|
822
|
-
error={errors[`id:${option.id}`]}>
|
|
823
|
-
<WrapperSubOption
|
|
824
|
-
style={{
|
|
825
|
-
backgroundColor: isError(option.id),
|
|
826
|
-
borderRadius: 7.6
|
|
827
|
-
}}>
|
|
828
|
-
{option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
|
|
829
|
-
(suboption: any) => {
|
|
830
|
-
const currentState =
|
|
831
|
-
productCart.options[
|
|
832
|
-
`id:${option.id}`
|
|
833
|
-
]?.suboptions[
|
|
834
|
-
`id:${suboption.id}`
|
|
835
|
-
] || {};
|
|
836
|
-
const balance =
|
|
837
|
-
productCart.options[
|
|
838
|
-
`id:${option.id}`
|
|
839
|
-
]?.balance || 0;
|
|
840
|
-
return (
|
|
841
|
-
<ProductOptionSubOption
|
|
842
|
-
key={suboption.id}
|
|
843
|
-
isSoldOut={isSoldOut}
|
|
844
|
-
onChange={
|
|
845
|
-
handleChangeSuboptionState
|
|
846
|
-
}
|
|
847
|
-
balance={balance}
|
|
848
|
-
option={option}
|
|
849
|
-
suboption={suboption}
|
|
850
|
-
state={currentState}
|
|
851
|
-
disabled={
|
|
852
|
-
isSoldOut ||
|
|
853
|
-
maxProductQuantity <= 0
|
|
854
|
-
}
|
|
855
|
-
setIsScrollAvailable={setIsScrollAvailable}
|
|
856
|
-
error={errors[`id:${option.id}`]}
|
|
857
|
-
/>
|
|
858
|
-
);
|
|
859
|
-
},
|
|
860
|
-
)}
|
|
861
|
-
</WrapperSubOption>
|
|
862
|
-
</ProductOption>
|
|
863
|
-
</View>
|
|
864
|
-
)}
|
|
865
|
-
</React.Fragment>
|
|
866
|
-
);
|
|
867
|
-
}),
|
|
868
|
-
)}
|
|
869
|
-
</>
|
|
870
|
-
) : (
|
|
871
|
-
<>
|
|
872
|
-
{selOpt === 0 ? (
|
|
873
|
-
<View style={styles.optionContainer}>
|
|
874
|
-
<SectionTitle>
|
|
875
|
-
<OText size={16}>
|
|
876
|
-
{t('INGREDIENTS', 'Ingredients')}
|
|
877
|
-
</OText>
|
|
878
|
-
</SectionTitle>
|
|
879
|
-
<WrapperIngredients>
|
|
880
|
-
{product?.ingredients.map((ingredient: any) => (
|
|
881
|
-
<ProductIngredient
|
|
882
|
-
key={ingredient.id}
|
|
883
|
-
ingredient={ingredient}
|
|
884
|
-
state={
|
|
885
|
-
productCart.ingredients[`id:${ingredient.id}`]
|
|
886
|
-
}
|
|
887
|
-
onChange={handleChangeIngredientState}
|
|
888
|
-
isSoldOut={isSoldOut}
|
|
889
|
-
/>
|
|
890
|
-
))}
|
|
891
|
-
</WrapperIngredients>
|
|
892
|
-
</View>
|
|
893
|
-
) : (
|
|
894
|
-
<>
|
|
895
|
-
{product?.extras.map((extra: any) =>
|
|
896
|
-
extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
|
|
897
|
-
if (
|
|
898
|
-
option.id == selOpt ||
|
|
899
|
-
(hasRespected(
|
|
900
|
-
extra.options,
|
|
901
|
-
option.respect_to,
|
|
902
|
-
) &&
|
|
903
|
-
showOption(option))
|
|
904
|
-
) {
|
|
905
|
-
const currentState =
|
|
906
|
-
productCart.options[`id:${option.id}`] || {};
|
|
907
|
-
return (
|
|
908
|
-
<React.Fragment key={option.id}>
|
|
909
|
-
{showOption(option) && (
|
|
910
|
-
<View style={styles.optionContainer}>
|
|
911
|
-
<ProductOption
|
|
912
|
-
option={option}
|
|
913
|
-
currentState={currentState}
|
|
914
|
-
error={errors[`id:${option.id}`]}>
|
|
915
|
-
<WrapperSubOption
|
|
916
|
-
style={{
|
|
917
|
-
backgroundColor: isError(
|
|
918
|
-
option.id,
|
|
919
|
-
),
|
|
920
|
-
}}>
|
|
921
|
-
{option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
|
|
922
|
-
(suboption: any) => {
|
|
923
|
-
const currentState =
|
|
924
|
-
productCart.options[
|
|
925
|
-
`id:${option.id}`
|
|
926
|
-
]?.suboptions[
|
|
927
|
-
`id:${suboption.id}`
|
|
928
|
-
] || {};
|
|
929
|
-
const balance =
|
|
930
|
-
productCart.options[
|
|
931
|
-
`id:${option.id}`
|
|
932
|
-
]?.balance || 0;
|
|
933
|
-
return (
|
|
934
|
-
<ProductOptionSubOption
|
|
935
|
-
key={suboption.id}
|
|
936
|
-
onChange={
|
|
937
|
-
handleChangeSuboptionState
|
|
938
|
-
}
|
|
939
|
-
balance={balance}
|
|
940
|
-
option={option}
|
|
941
|
-
suboption={suboption}
|
|
942
|
-
state={currentState}
|
|
943
|
-
disabled={
|
|
944
|
-
isSoldOut ||
|
|
945
|
-
maxProductQuantity <= 0
|
|
946
|
-
}
|
|
947
|
-
/>
|
|
948
|
-
);
|
|
949
|
-
},
|
|
950
|
-
)}
|
|
951
|
-
</WrapperSubOption>
|
|
952
|
-
</ProductOption>
|
|
953
|
-
</View>
|
|
954
|
-
)}
|
|
955
|
-
</React.Fragment>
|
|
956
|
-
);
|
|
866
|
+
<ProductEditions
|
|
867
|
+
style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
|
|
868
|
+
onLayout={(event: any) => {
|
|
869
|
+
setEditionsLayoutY(event.nativeEvent.layout?.y)
|
|
870
|
+
}}
|
|
871
|
+
>
|
|
872
|
+
<>
|
|
873
|
+
{product?.ingredients?.length > 0 && (
|
|
874
|
+
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
|
|
875
|
+
<SectionTitle>
|
|
876
|
+
<OText size={16}>
|
|
877
|
+
{t('INGREDIENTS', 'Ingredients')}
|
|
878
|
+
</OText>
|
|
879
|
+
</SectionTitle>
|
|
880
|
+
<WrapperIngredients>
|
|
881
|
+
{product?.ingredients.map((ingredient: any) => (
|
|
882
|
+
<ProductIngredient
|
|
883
|
+
key={ingredient.id}
|
|
884
|
+
ingredient={ingredient}
|
|
885
|
+
state={
|
|
886
|
+
productCart.ingredients[`id:${ingredient.id}`]
|
|
957
887
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
888
|
+
onChange={handleChangeIngredientState}
|
|
889
|
+
isSoldOut={isSoldOut}
|
|
890
|
+
/>
|
|
891
|
+
))}
|
|
892
|
+
</WrapperIngredients>
|
|
893
|
+
</View>
|
|
894
|
+
)}
|
|
895
|
+
{product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
|
|
896
|
+
extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
|
|
897
|
+
const currentState =
|
|
898
|
+
productCart.options[`id:${option.id}`] || {};
|
|
899
|
+
return (
|
|
900
|
+
<React.Fragment key={`popt_${option.id}`}>
|
|
901
|
+
{showOption(option) && (
|
|
902
|
+
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
|
|
903
|
+
<ProductOption
|
|
904
|
+
option={option}
|
|
905
|
+
currentState={currentState}
|
|
906
|
+
error={errors[`id:${option.id}`]}>
|
|
907
|
+
<WrapperSubOption
|
|
908
|
+
style={{
|
|
909
|
+
backgroundColor: isError(option.id),
|
|
910
|
+
borderRadius: 7.6
|
|
911
|
+
}}>
|
|
912
|
+
{option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
|
|
913
|
+
(suboption: any) => {
|
|
914
|
+
const currentState =
|
|
915
|
+
productCart.options[
|
|
916
|
+
`id:${option.id}`
|
|
917
|
+
]?.suboptions[
|
|
918
|
+
`id:${suboption.id}`
|
|
919
|
+
] || {};
|
|
920
|
+
const balance =
|
|
921
|
+
productCart.options[
|
|
922
|
+
`id:${option.id}`
|
|
923
|
+
]?.balance || 0;
|
|
924
|
+
return (
|
|
925
|
+
<ProductOptionSubOption
|
|
926
|
+
key={suboption.id}
|
|
927
|
+
isSoldOut={isSoldOut}
|
|
928
|
+
onChange={
|
|
929
|
+
handleChangeSuboptionState
|
|
930
|
+
}
|
|
931
|
+
balance={balance}
|
|
932
|
+
option={option}
|
|
933
|
+
suboption={suboption}
|
|
934
|
+
state={currentState}
|
|
935
|
+
disabled={
|
|
936
|
+
isSoldOut ||
|
|
937
|
+
maxProductQuantity <= 0
|
|
938
|
+
}
|
|
939
|
+
setIsScrollAvailable={setIsScrollAvailable}
|
|
940
|
+
error={errors[`id:${option.id}`]}
|
|
941
|
+
/>
|
|
942
|
+
);
|
|
943
|
+
},
|
|
944
|
+
)}
|
|
945
|
+
</WrapperSubOption>
|
|
946
|
+
</ProductOption>
|
|
947
|
+
</View>
|
|
948
|
+
)}
|
|
949
|
+
</React.Fragment>
|
|
950
|
+
);
|
|
951
|
+
}),
|
|
952
|
+
)}
|
|
953
|
+
</>
|
|
964
954
|
{!product?.hide_special_instructions && (
|
|
965
955
|
<ProductComment>
|
|
966
956
|
<SectionTitle>
|
|
@@ -984,7 +974,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
984
974
|
)}
|
|
985
975
|
</ProductEditions>
|
|
986
976
|
)}
|
|
987
|
-
{!!error && error
|
|
977
|
+
{!!error && error?.length > 0 && (
|
|
988
978
|
<NotFoundSource content={error[0]?.message || error[0]} />
|
|
989
979
|
)}
|
|
990
980
|
</ScrollView>
|
|
@@ -1007,7 +997,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1007
997
|
disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || ((productCart?.quantity + productAddedToCartLength) <= product?.minimum_per_order)}>
|
|
1008
998
|
<OIcon
|
|
1009
999
|
src={theme.images.general.minus}
|
|
1010
|
-
width={
|
|
1000
|
+
width={20}
|
|
1011
1001
|
color={
|
|
1012
1002
|
productCart.quantity === 1 || isSoldOut
|
|
1013
1003
|
? theme.colors.backgroundGray
|
|
@@ -1028,7 +1018,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1028
1018
|
borderRadius: 8,
|
|
1029
1019
|
borderColor: theme.colors.inputBorderColor,
|
|
1030
1020
|
height: 44,
|
|
1031
|
-
marginHorizontal: 10
|
|
1021
|
+
marginHorizontal: 10,
|
|
1022
|
+
fontSize: 16
|
|
1032
1023
|
}}
|
|
1033
1024
|
/>
|
|
1034
1025
|
)}
|
|
@@ -1051,7 +1042,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1051
1042
|
}>
|
|
1052
1043
|
<OIcon
|
|
1053
1044
|
src={theme.images.general.plus}
|
|
1054
|
-
width={
|
|
1045
|
+
width={20}
|
|
1055
1046
|
color={
|
|
1056
1047
|
maxProductQuantity <= 0 ||
|
|
1057
1048
|
(productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
|