ordering-ui-react-native 0.21.45 → 0.21.46-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/PaymentOptionsWebView/index.tsx +1 -0
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +3 -1
- package/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +6 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +7 -3
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/DriverMap/index.tsx +36 -23
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +30 -15
- package/themes/business/src/components/MessagesOption/index.tsx +2 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
- package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +30 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +40 -20
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderSummary/index.tsx +240 -76
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +125 -46
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +37 -40
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +5 -3
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +16 -2
- package/themes/business/src/utils/index.tsx +5 -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/Checkout/index.tsx +6 -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/original/index.tsx +12 -4
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +41 -12
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +18 -4
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +7 -10
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +18 -10
- package/themes/original/src/components/BusinessController/styles.tsx +8 -7
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +47 -358
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +4 -3
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +34 -19
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
- package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +7 -7
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +2 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +32 -9
- package/themes/original/src/components/CartContent/index.tsx +96 -58
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +144 -62
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/DatePicker/index.tsx +33 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/Favorite/index.tsx +9 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
- package/themes/original/src/components/GPSButton/index.tsx +1 -1
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +7 -0
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
- package/themes/original/src/components/HelpGuide/index.tsx +5 -0
- package/themes/original/src/components/HelpOrder/index.tsx +5 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +3 -8
- package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
- package/themes/original/src/components/LoginForm/index.tsx +9 -3
- package/themes/original/src/components/MessageListing/index.tsx +6 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +19 -4
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +126 -61
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
- package/themes/original/src/components/MyOrders/index.tsx +28 -28
- package/themes/original/src/components/NavBar/index.tsx +5 -0
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/Notifications/index.tsx +9 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +708 -663
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +3 -1
- package/themes/original/src/components/OrderTypeSelector/index.tsx +10 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +3 -5
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +47 -4
- package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
- package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +170 -252
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -44
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +13 -11
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ServiceForm/index.tsx +1 -1
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/Sessions/index.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +67 -59
- package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +4 -3
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +12 -35
- package/themes/original/src/components/StripeElementsForm/index.tsx +79 -59
- package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserFormDetails/index.tsx +123 -75
- package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
- package/themes/original/src/components/UserProfile/index.tsx +3 -2
- package/themes/original/src/components/UserProfileForm/index.tsx +5 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +7 -4
- package/themes/original/src/components/Wallets/styles.tsx +2 -1
- package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -5
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/components/shared/OModal.tsx +12 -14
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +4 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -56,6 +56,10 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
56
56
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
57
57
|
import NavBar from '../NavBar';
|
|
58
58
|
import { orderTypeList } from '../../utils';
|
|
59
|
+
import { ActionButton } from './ActionButton'
|
|
60
|
+
import { ExtraOptions } from './ExtraOptions'
|
|
61
|
+
import { IOScrollView } from 'react-native-intersection-observer';
|
|
62
|
+
|
|
59
63
|
const windowWidth = Dimensions.get('window').width;
|
|
60
64
|
|
|
61
65
|
export const ProductOptionsUI = (props: any) => {
|
|
@@ -79,12 +83,12 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
79
83
|
actionStatus,
|
|
80
84
|
handleCreateGuestUser
|
|
81
85
|
} = props;
|
|
82
|
-
|
|
83
86
|
const theme = useTheme();
|
|
84
87
|
const [, { showToast }] = useToast()
|
|
85
88
|
const [events] = useEvent()
|
|
86
|
-
|
|
89
|
+
const commentRef = useRef()
|
|
87
90
|
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
91
|
+
const hideProductDummyLogo = theme?.business_view?.components?.products?.components?.product?.components?.dummy?.hidden
|
|
88
92
|
|
|
89
93
|
const styles = StyleSheet.create({
|
|
90
94
|
mainContainer: {
|
|
@@ -138,7 +142,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
138
142
|
slide1: {
|
|
139
143
|
flex: 1,
|
|
140
144
|
alignItems: 'center',
|
|
141
|
-
width: '100%'
|
|
145
|
+
width: '100%'
|
|
142
146
|
},
|
|
143
147
|
mainSwiper: {
|
|
144
148
|
height: 258,
|
|
@@ -177,7 +181,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
177
181
|
marginTop: 10
|
|
178
182
|
},
|
|
179
183
|
wrapperNavbar: {
|
|
180
|
-
paddingHorizontal:
|
|
184
|
+
paddingHorizontal: 20,
|
|
181
185
|
paddingTop: 0,
|
|
182
186
|
}
|
|
183
187
|
});
|
|
@@ -208,7 +212,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
208
212
|
const [editionsLayoutY, setEditionsLayoutY] = useState(null)
|
|
209
213
|
const [viewedProduct, setViewedProduct] = useState<any>(null)
|
|
210
214
|
const [showTitle, setShowTitle] = useState(false)
|
|
211
|
-
|
|
215
|
+
const productOptionsMounted = useRef(false)
|
|
212
216
|
const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
|
|
213
217
|
const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
|
|
214
218
|
|
|
@@ -283,14 +287,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
283
287
|
setQtyBy({ [val]: true, [!val]: false })
|
|
284
288
|
}
|
|
285
289
|
|
|
286
|
-
const onStateChange = useCallback((state) => {
|
|
290
|
+
const onStateChange = useCallback((state : string) => {
|
|
287
291
|
if (state === "ended") {
|
|
288
292
|
setPlaying(false);
|
|
289
293
|
}
|
|
290
294
|
}, []);
|
|
291
295
|
|
|
292
296
|
const togglePlaying = useCallback(() => {
|
|
293
|
-
setPlaying((prev) => !prev);
|
|
297
|
+
setPlaying((prev : any) => !prev);
|
|
294
298
|
}, []);
|
|
295
299
|
|
|
296
300
|
const onChangeProductCartQuantity = (quantity: number) => {
|
|
@@ -321,57 +325,20 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
321
325
|
if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
|
|
322
326
|
}
|
|
323
327
|
|
|
324
|
-
|
|
325
|
-
|
|
328
|
+
let _optionLayout: any = {}
|
|
329
|
+
|
|
330
|
+
const handleOnLayout = (event: any, optionId: any, lastMounts: boolean) => {
|
|
331
|
+
if (suboptionsLength >= 200) {
|
|
332
|
+
return
|
|
333
|
+
}
|
|
334
|
+
_optionLayout = { ..._optionLayout }
|
|
326
335
|
const optionKey = 'id:' + optionId
|
|
327
336
|
_optionLayout[optionKey] = { y: event.nativeEvent.layout?.y }
|
|
328
|
-
|
|
337
|
+
if (lastMounts) {
|
|
338
|
+
setOptionLayout(_optionLayout)
|
|
339
|
+
}
|
|
329
340
|
}
|
|
330
341
|
|
|
331
|
-
const saveErrors =
|
|
332
|
-
orderState.loading ||
|
|
333
|
-
maxProductQuantity === 0 ||
|
|
334
|
-
Object.keys(errors)?.length > 0;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
const ExtraOptions = ({ eID, options }: any) => (
|
|
338
|
-
<>
|
|
339
|
-
{options.map(({ id, name, respect_to, suboptions }: any) => (
|
|
340
|
-
<React.Fragment key={`cont_key_${id}`}>
|
|
341
|
-
{respect_to == null && suboptions?.length > 0 && (
|
|
342
|
-
<TouchableOpacity
|
|
343
|
-
key={`eopt_key_${id}`}
|
|
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
|
-
}}
|
|
351
|
-
style={[
|
|
352
|
-
styles.extraItem,
|
|
353
|
-
{
|
|
354
|
-
borderBottomColor:
|
|
355
|
-
selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
|
|
356
|
-
},
|
|
357
|
-
]}>
|
|
358
|
-
<OText
|
|
359
|
-
color={
|
|
360
|
-
selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
|
|
361
|
-
}
|
|
362
|
-
size={12}
|
|
363
|
-
weight={selOpt == id ? '600' : 'normal'}
|
|
364
|
-
style={{ maxWidth: 150 }}
|
|
365
|
-
numberOfLines={1}>
|
|
366
|
-
{name}
|
|
367
|
-
</OText>
|
|
368
|
-
</TouchableOpacity>
|
|
369
|
-
)}
|
|
370
|
-
</React.Fragment>
|
|
371
|
-
))}
|
|
372
|
-
</>
|
|
373
|
-
);
|
|
374
|
-
|
|
375
342
|
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
376
343
|
setShowTitle(contentOffset.y > 30)
|
|
377
344
|
}
|
|
@@ -431,90 +398,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
431
398
|
}
|
|
432
399
|
}, [product])
|
|
433
400
|
|
|
434
|
-
const ActionButton = () => {
|
|
435
|
-
return (
|
|
436
|
-
<View
|
|
437
|
-
style={{
|
|
438
|
-
width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
|
|
439
|
-
}}>
|
|
440
|
-
{((productCart &&
|
|
441
|
-
auth &&
|
|
442
|
-
orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
|
|
443
|
-
<OButton
|
|
444
|
-
onClick={() => handleSaveProduct()}
|
|
445
|
-
imgRightSrc=""
|
|
446
|
-
text={`${orderState.loading
|
|
447
|
-
? t('LOADING', 'Loading')
|
|
448
|
-
: (isSoldOut || maxProductQuantity <= 0)
|
|
449
|
-
? t('SOLD_OUT', 'Sold out')
|
|
450
|
-
: editMode
|
|
451
|
-
? t('UPDATE', 'Update')
|
|
452
|
-
: t('ADD', 'Add')
|
|
453
|
-
}`}
|
|
454
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))}
|
|
455
|
-
textStyle={{
|
|
456
|
-
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
457
|
-
fontSize: orderState.loading || editMode ? 10 : 14
|
|
458
|
-
}}
|
|
459
|
-
style={{
|
|
460
|
-
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
|
|
461
|
-
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
|
|
462
|
-
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
463
|
-
borderRadius: 7.6,
|
|
464
|
-
height: 44,
|
|
465
|
-
shadowOpacity: 0,
|
|
466
|
-
borderWidth: 1,
|
|
467
|
-
marginTop: isHaveWeight ? 10 : 0
|
|
468
|
-
}}
|
|
469
|
-
/>
|
|
470
|
-
)}
|
|
471
|
-
{auth &&
|
|
472
|
-
!orderState.options?.address_id &&
|
|
473
|
-
(orderState.loading ? (
|
|
474
|
-
<OButton
|
|
475
|
-
isDisabled
|
|
476
|
-
text={t('LOADING', 'Loading')}
|
|
477
|
-
imgRightSrc=""
|
|
478
|
-
textStyle={{ fontSize: 10 }}
|
|
479
|
-
/>
|
|
480
|
-
) : (
|
|
481
|
-
<OButton onClick={navigation.navigate('AddressList')} />
|
|
482
|
-
))}
|
|
483
|
-
{!auth && (
|
|
484
|
-
<OButton
|
|
485
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
486
|
-
onClick={() => handleRedirectLogin()}
|
|
487
|
-
text={
|
|
488
|
-
isSoldOut || maxProductQuantity <= 0
|
|
489
|
-
? t('SOLD_OUT', 'Sold out')
|
|
490
|
-
: t('LOGIN_SIGNUP', 'Login / Sign Up')
|
|
491
|
-
}
|
|
492
|
-
imgRightSrc=""
|
|
493
|
-
textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
|
|
494
|
-
style={{
|
|
495
|
-
height: 42,
|
|
496
|
-
borderColor: theme.colors.primary,
|
|
497
|
-
backgroundColor: theme.colors.white,
|
|
498
|
-
paddingLeft: 0,
|
|
499
|
-
paddingRight: 0
|
|
500
|
-
}}
|
|
501
|
-
/>
|
|
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
|
-
)}
|
|
514
|
-
</View>
|
|
515
|
-
)
|
|
516
|
-
}
|
|
517
|
-
|
|
518
401
|
useEffect(() => {
|
|
519
402
|
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
520
403
|
scrollViewRef.current.scrollToEnd({ animated: true })
|
|
@@ -530,6 +413,35 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
530
413
|
events.emit('product_viewed', product)
|
|
531
414
|
}, [product?.id, viewedProduct])
|
|
532
415
|
|
|
416
|
+
const actionButtonProps = {
|
|
417
|
+
navigation,
|
|
418
|
+
isHaveWeight,
|
|
419
|
+
isSoldOut,
|
|
420
|
+
maxProductQuantity,
|
|
421
|
+
productCart,
|
|
422
|
+
handleSaveProduct,
|
|
423
|
+
editMode,
|
|
424
|
+
product,
|
|
425
|
+
errors,
|
|
426
|
+
productAddedToCartLength,
|
|
427
|
+
handleRedirectLogin,
|
|
428
|
+
guestCheckoutEnabled,
|
|
429
|
+
orderTypeEnabled,
|
|
430
|
+
handleUpdateGuest,
|
|
431
|
+
actionStatus
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const extraOptionsProps = {
|
|
435
|
+
setSelectedOpt,
|
|
436
|
+
scrollViewRef,
|
|
437
|
+
optionLayout,
|
|
438
|
+
editionsLayoutY,
|
|
439
|
+
styles,
|
|
440
|
+
selOpt
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const suboptionsLength = product?.extras?.reduce((acc : number, extras : any) => acc + extras?.options?.reduce((accSuboptions : number, options: any) => accSuboptions + options?.suboptions?.length, 0), 0)
|
|
444
|
+
|
|
533
445
|
return (
|
|
534
446
|
<SafeAreaView style={{ flex: 1 }}>
|
|
535
447
|
<View style={styles.wrapperNavbar}>
|
|
@@ -556,7 +468,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
556
468
|
</TopHeader>
|
|
557
469
|
</View>
|
|
558
470
|
{!error && (
|
|
559
|
-
<
|
|
471
|
+
<IOScrollView
|
|
560
472
|
ref={scrollViewRef}
|
|
561
473
|
contentContainerStyle={{ paddingBottom: 80 }}
|
|
562
474
|
stickyHeaderIndices={[2]}
|
|
@@ -576,119 +488,123 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
576
488
|
</View>
|
|
577
489
|
) : (
|
|
578
490
|
<>
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}
|
|
596
|
-
nextButton={
|
|
597
|
-
<View style={styles.swiperButton}>
|
|
598
|
-
<IconAntDesign
|
|
599
|
-
name="caretright"
|
|
600
|
-
color={theme.colors.white}
|
|
601
|
-
size={13}
|
|
602
|
-
// style={styles.starIcon}
|
|
603
|
-
/>
|
|
604
|
-
</View>
|
|
605
|
-
}
|
|
606
|
-
>
|
|
607
|
-
{gallery && gallery?.length > 0 && gallery.map((img, i) => (
|
|
608
|
-
<View
|
|
609
|
-
style={styles.slide1}
|
|
610
|
-
key={i}
|
|
611
|
-
>
|
|
612
|
-
{(String(img).includes('http') || typeof img === 'number') ? (
|
|
613
|
-
<FastImage
|
|
614
|
-
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
|
|
615
|
-
source={typeof img !== 'number' ? {
|
|
616
|
-
uri: optimizeImage(img, 'h_1024,c_limit'),
|
|
617
|
-
priority: FastImage.priority.normal,
|
|
618
|
-
} : img}
|
|
619
|
-
/>
|
|
620
|
-
) : (
|
|
621
|
-
<>
|
|
622
|
-
<YoutubePlayer
|
|
623
|
-
height={'100%'}
|
|
624
|
-
width={'100%'}
|
|
625
|
-
play={playing}
|
|
626
|
-
videoId={img}
|
|
627
|
-
onChangeState={onStateChange}
|
|
491
|
+
{(product?.images || !hideProductDummyLogo) && (
|
|
492
|
+
<>
|
|
493
|
+
<Swiper
|
|
494
|
+
loop={false}
|
|
495
|
+
ref={swiperRef}
|
|
496
|
+
showsButtons={true}
|
|
497
|
+
style={styles.mainSwiper}
|
|
498
|
+
showsPagination={false}
|
|
499
|
+
onIndexChanged={(index : any) => handleChangeMainIndex(index)}
|
|
500
|
+
prevButton={
|
|
501
|
+
<View style={styles.swiperButton}>
|
|
502
|
+
<IconAntDesign
|
|
503
|
+
name="caretleft"
|
|
504
|
+
color={theme.colors.white}
|
|
505
|
+
size={13}
|
|
506
|
+
// style={styles.starIcon}
|
|
628
507
|
/>
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
paddingHorizontal: 30,
|
|
639
|
-
paddingVertical: 15
|
|
640
|
-
}}
|
|
641
|
-
>
|
|
642
|
-
{gallery?.length > 1 && gallery.map((img, index) => (
|
|
643
|
-
<TouchableOpacity
|
|
644
|
-
key={index}
|
|
645
|
-
onPress={() => handleClickThumb(index)}
|
|
646
|
-
>
|
|
647
|
-
<View
|
|
648
|
-
style={{
|
|
649
|
-
height: 56,
|
|
650
|
-
borderRadius: 8,
|
|
651
|
-
margin: 8,
|
|
652
|
-
opacity: index === thumbsSwiper ? 1 : 0.8
|
|
653
|
-
}}
|
|
654
|
-
>
|
|
655
|
-
{String(img).includes('http') ? (
|
|
656
|
-
<OIcon
|
|
657
|
-
url={img}
|
|
658
|
-
style={{
|
|
659
|
-
borderColor: theme.colors.lightGray,
|
|
660
|
-
borderRadius: 8,
|
|
661
|
-
minHeight: '100%',
|
|
662
|
-
opacity: isSoldOut ? 0.5 : 1
|
|
663
|
-
}}
|
|
664
|
-
width={56}
|
|
665
|
-
height={56}
|
|
666
|
-
cover
|
|
508
|
+
</View>
|
|
509
|
+
}
|
|
510
|
+
nextButton={
|
|
511
|
+
<View style={styles.swiperButton}>
|
|
512
|
+
<IconAntDesign
|
|
513
|
+
name="caretright"
|
|
514
|
+
color={theme.colors.white}
|
|
515
|
+
size={13}
|
|
516
|
+
// style={styles.starIcon}
|
|
667
517
|
/>
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
518
|
+
</View>
|
|
519
|
+
}
|
|
520
|
+
>
|
|
521
|
+
{gallery && gallery?.length > 0 && gallery.map((img : any, i: number) => (
|
|
522
|
+
<View
|
|
523
|
+
style={styles.slide1}
|
|
524
|
+
key={i}
|
|
525
|
+
>
|
|
526
|
+
{(String(img).includes('http') || typeof img === 'number') ? (
|
|
527
|
+
<FastImage
|
|
528
|
+
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
|
|
529
|
+
source={typeof img !== 'number' ? {
|
|
530
|
+
uri: optimizeImage(img, 'h_1024,c_limit'),
|
|
531
|
+
priority: FastImage.priority.normal,
|
|
532
|
+
} : img}
|
|
533
|
+
/>
|
|
534
|
+
) : (
|
|
535
|
+
<>
|
|
536
|
+
<YoutubePlayer
|
|
537
|
+
height={'100%'}
|
|
538
|
+
width={'100%'}
|
|
539
|
+
play={playing}
|
|
540
|
+
videoId={img}
|
|
541
|
+
onChangeState={onStateChange}
|
|
542
|
+
/>
|
|
543
|
+
<Button title={playing ? "pause" : "play"} onPress={togglePlaying} />
|
|
544
|
+
</>
|
|
545
|
+
)}
|
|
546
|
+
</View>
|
|
547
|
+
))}
|
|
548
|
+
</Swiper>
|
|
549
|
+
<ScrollView
|
|
550
|
+
horizontal
|
|
551
|
+
contentContainerStyle={{
|
|
552
|
+
paddingHorizontal: 20,
|
|
553
|
+
paddingVertical: 15
|
|
554
|
+
}}
|
|
555
|
+
>
|
|
556
|
+
{gallery?.length > 1 && gallery.map((img: any, index: number) => (
|
|
557
|
+
<TouchableOpacity
|
|
558
|
+
key={index}
|
|
559
|
+
onPress={() => handleClickThumb(index)}
|
|
560
|
+
>
|
|
561
|
+
<View
|
|
671
562
|
style={{
|
|
672
|
-
|
|
563
|
+
height: 56,
|
|
673
564
|
borderRadius: 8,
|
|
674
|
-
|
|
675
|
-
opacity:
|
|
565
|
+
margin: 8,
|
|
566
|
+
opacity: index === thumbsSwiper ? 1 : 0.8
|
|
676
567
|
}}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
568
|
+
>
|
|
569
|
+
{String(img).includes('http') ? (
|
|
570
|
+
<OIcon
|
|
571
|
+
url={img}
|
|
572
|
+
style={{
|
|
573
|
+
borderColor: theme.colors.lightGray,
|
|
574
|
+
borderRadius: 8,
|
|
575
|
+
minHeight: '100%',
|
|
576
|
+
opacity: isSoldOut ? 0.5 : 1
|
|
577
|
+
}}
|
|
578
|
+
width={56}
|
|
579
|
+
height={56}
|
|
580
|
+
cover
|
|
581
|
+
/>
|
|
582
|
+
) : (
|
|
583
|
+
<OIcon
|
|
584
|
+
url={'https://img.youtube.com/vi/' + img + '/0.jpg'}
|
|
585
|
+
style={{
|
|
586
|
+
borderColor: theme.colors.lightGray,
|
|
587
|
+
borderRadius: 8,
|
|
588
|
+
minHeight: '100%',
|
|
589
|
+
opacity: isSoldOut ? 0.5 : 1
|
|
590
|
+
}}
|
|
591
|
+
width={56}
|
|
592
|
+
height={56}
|
|
593
|
+
cover
|
|
594
|
+
/>
|
|
595
|
+
)}
|
|
596
|
+
</View>
|
|
597
|
+
</TouchableOpacity>
|
|
684
598
|
|
|
685
|
-
|
|
686
|
-
|
|
599
|
+
))}
|
|
600
|
+
</ScrollView>
|
|
601
|
+
</>
|
|
602
|
+
)}
|
|
687
603
|
</>
|
|
688
604
|
)}
|
|
689
605
|
</WrapHeader>
|
|
690
606
|
<ProductSummary
|
|
691
|
-
ph={
|
|
607
|
+
ph={20}
|
|
692
608
|
onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
|
|
693
609
|
>
|
|
694
610
|
<ProductTitle>
|
|
@@ -821,8 +737,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
821
737
|
</OText>
|
|
822
738
|
</TouchableOpacity>
|
|
823
739
|
)}
|
|
824
|
-
{product?.extras?.map((extra: any) =>
|
|
825
|
-
<ExtraOptions key={extra.id} options={extra.options} />
|
|
740
|
+
{suboptionsLength < 200 && product?.extras?.map((extra: any) =>
|
|
741
|
+
<ExtraOptions key={extra.id} options={extra.options} {...extraOptionsProps} />
|
|
826
742
|
)}
|
|
827
743
|
</ExtraOptionWrap>
|
|
828
744
|
)}
|
|
@@ -866,14 +782,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
866
782
|
</>
|
|
867
783
|
) : (
|
|
868
784
|
<ProductEditions
|
|
869
|
-
style={{ paddingHorizontal:
|
|
785
|
+
style={{ paddingHorizontal: 20 }}
|
|
870
786
|
onLayout={(event: any) => {
|
|
871
787
|
setEditionsLayoutY(event.nativeEvent.layout?.y)
|
|
872
788
|
}}
|
|
873
789
|
>
|
|
874
790
|
<>
|
|
875
791
|
{product?.ingredients?.length > 0 && (
|
|
876
|
-
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
|
|
792
|
+
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0, true)}>
|
|
877
793
|
<SectionTitle>
|
|
878
794
|
<OText size={16}>
|
|
879
795
|
{t('INGREDIENTS', 'Ingredients')}
|
|
@@ -895,13 +811,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
895
811
|
</View>
|
|
896
812
|
)}
|
|
897
813
|
{product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
|
|
898
|
-
extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
|
|
814
|
+
extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => {
|
|
899
815
|
const currentState =
|
|
900
816
|
productCart.options[`id:${option.id}`] || {};
|
|
901
817
|
return (
|
|
902
818
|
<React.Fragment key={`popt_${option.id}`}>
|
|
903
819
|
{showOption(option) && (
|
|
904
|
-
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
|
|
820
|
+
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id, extra.options?.length <= i + 2)}>
|
|
905
821
|
<ProductOption
|
|
906
822
|
option={option}
|
|
907
823
|
currentState={currentState}
|
|
@@ -936,6 +852,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
936
852
|
}
|
|
937
853
|
setIsScrollAvailable={setIsScrollAvailable}
|
|
938
854
|
error={errors[`id:${option.id}`]}
|
|
855
|
+
enableIntersection={suboptionsLength >= 200}
|
|
939
856
|
/>
|
|
940
857
|
);
|
|
941
858
|
},
|
|
@@ -953,7 +870,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
953
870
|
<ProductComment>
|
|
954
871
|
<SectionTitle>
|
|
955
872
|
<OText size={16} weight={'600'} lineHeight={24}>
|
|
956
|
-
{t('
|
|
873
|
+
{t('COMMENTS', 'Special comment')}
|
|
957
874
|
</OText>
|
|
958
875
|
</SectionTitle>
|
|
959
876
|
<OInput
|
|
@@ -967,6 +884,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
967
884
|
!(productCart && !isSoldOut && maxProductQuantity)
|
|
968
885
|
}
|
|
969
886
|
style={styles.comment}
|
|
887
|
+
forwardRef={commentRef}
|
|
970
888
|
/>
|
|
971
889
|
</ProductComment>
|
|
972
890
|
)}
|
|
@@ -975,7 +893,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
975
893
|
{!!error && error?.length > 0 && (
|
|
976
894
|
<NotFoundSource content={error[0]?.message || error[0]} />
|
|
977
895
|
)}
|
|
978
|
-
</
|
|
896
|
+
</IOScrollView>
|
|
979
897
|
)}
|
|
980
898
|
{!loading && !error && product && (
|
|
981
899
|
<ProductActions ios={Platform?.OS === 'ios'} isColumn={isHaveWeight}>
|
|
@@ -1086,9 +1004,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1086
1004
|
)}
|
|
1087
1005
|
</>
|
|
1088
1006
|
)}
|
|
1089
|
-
{!isHaveWeight && <ActionButton />}
|
|
1007
|
+
{!isHaveWeight && <ActionButton {...actionButtonProps} />}
|
|
1090
1008
|
</View>
|
|
1091
|
-
{isHaveWeight && <ActionButton />}
|
|
1009
|
+
{isHaveWeight && <ActionButton {...actionButtonProps} />}
|
|
1092
1010
|
</ProductActions>
|
|
1093
1011
|
)}
|
|
1094
1012
|
</SafeAreaView>
|