ordering-ui-react-native 0.15.0 → 0.15.2-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -3
- package/src/DeliveryApp.tsx +32 -1
- package/src/components/BusinessTypeFilter/index.tsx +9 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/Home/index.tsx +3 -5
- package/src/components/LanguageSelector/index.tsx +65 -97
- package/src/components/LanguageSelector/styles.tsx +4 -17
- package/src/components/Messages/index.tsx +38 -30
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +25 -4
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +35 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/types/index.tsx +2 -9
- package/src/utils/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/Chat/index.tsx +32 -31
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +70 -116
- package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
- package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
- 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/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- 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/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/original/index.tsx +179 -0
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +27 -1
- package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +100 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +32 -21
- package/themes/original/src/components/BusinessListingSearch/index.tsx +7 -3
- package/themes/original/src/components/BusinessMenuList/index.tsx +14 -5
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +23 -30
- package/themes/original/src/components/BusinessReviews/index.tsx +8 -28
- package/themes/original/src/components/BusinessesListing/index.tsx +39 -52
- package/themes/original/src/components/Cart/index.tsx +40 -9
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +58 -33
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +105 -90
- package/themes/original/src/components/LoginForm/index.tsx +156 -70
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/Messages/index.tsx +52 -45
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +127 -152
- package/themes/original/src/components/MomentOption/styles.tsx +42 -18
- package/themes/original/src/components/OrderDetails/index.tsx +102 -125
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +6 -7
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +15 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +6 -2
- package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +157 -108
- package/themes/original/src/components/ProductForm/styles.tsx +5 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +6 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/SingleProductCard/index.tsx +1 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +17 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +16 -11
- package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/types/index.tsx +64 -22
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
TimeContentWrapper,
|
|
22
22
|
TimeItem
|
|
23
23
|
} from './styles'
|
|
24
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
24
25
|
|
|
25
26
|
const windowHeight = Dimensions.get('window').height;
|
|
26
27
|
|
|
@@ -50,7 +51,9 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
50
51
|
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
51
52
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
52
53
|
const [isEnabled, setIsEnabled] = useState(false)
|
|
53
|
-
|
|
54
|
+
const { top } = useSafeAreaInsets()
|
|
55
|
+
const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
|
|
56
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
54
57
|
const styles = StyleSheet.create({
|
|
55
58
|
container: {
|
|
56
59
|
height: windowHeight,
|
|
@@ -299,60 +302,62 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
299
302
|
/>
|
|
300
303
|
</View>
|
|
301
304
|
</BusinessInfoWrapper>
|
|
302
|
-
|
|
303
|
-
<
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
305
|
+
{isPreOrderSetting && (
|
|
306
|
+
<PreorderTypeWrapper>
|
|
307
|
+
<OText
|
|
308
|
+
size={16}
|
|
309
|
+
style={{
|
|
310
|
+
fontWeight: '600',
|
|
311
|
+
lineHeight: 24,
|
|
312
|
+
marginBottom: 12
|
|
313
|
+
}}
|
|
314
|
+
>
|
|
315
|
+
{t('PREORDER_TYPE', 'Preorder type')}
|
|
316
|
+
</OText>
|
|
317
|
+
<SelectDropdown
|
|
318
|
+
defaultValueByIndex={selectedPreorderType}
|
|
319
|
+
data={preorderTypeList}
|
|
320
|
+
// disabled={orderState.loading}
|
|
321
|
+
onSelect={(selectedItem, index) => {
|
|
322
|
+
setSelectedPreorderType(index)
|
|
323
|
+
}}
|
|
324
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
325
|
+
return selectedItem.name
|
|
326
|
+
}}
|
|
327
|
+
rowTextForSelection={(item, index) => {
|
|
328
|
+
return item.name
|
|
329
|
+
}}
|
|
330
|
+
buttonStyle={styles.selectOption}
|
|
331
|
+
buttonTextStyle={{
|
|
332
|
+
color: theme.colors.disabled,
|
|
333
|
+
fontSize: 14,
|
|
334
|
+
textAlign: 'left',
|
|
335
|
+
marginHorizontal: 0
|
|
336
|
+
}}
|
|
337
|
+
dropdownStyle={{
|
|
338
|
+
borderRadius: 8,
|
|
339
|
+
borderColor: theme.colors.lightGray,
|
|
340
|
+
marginTop: Platform.OS === 'ios' ? 12 : -top
|
|
341
|
+
}}
|
|
342
|
+
rowStyle={{
|
|
343
|
+
borderBottomColor: theme.colors.backgroundGray100,
|
|
344
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
345
|
+
height: 40,
|
|
346
|
+
flexDirection: 'column',
|
|
347
|
+
alignItems: 'flex-start',
|
|
348
|
+
paddingTop: 8,
|
|
349
|
+
paddingHorizontal: 14
|
|
350
|
+
}}
|
|
351
|
+
rowTextStyle={{
|
|
352
|
+
color: theme.colors.disabled,
|
|
353
|
+
fontSize: 14,
|
|
354
|
+
marginHorizontal: 0
|
|
355
|
+
}}
|
|
356
|
+
renderDropdownIcon={() => dropDownIcon()}
|
|
357
|
+
dropdownOverlayColor='transparent'
|
|
358
|
+
/>
|
|
359
|
+
</PreorderTypeWrapper>
|
|
360
|
+
)}
|
|
356
361
|
{selectedPreorderType === 1 && (
|
|
357
362
|
<MenuWrapper>
|
|
358
363
|
<OText
|
|
@@ -372,78 +377,94 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
372
377
|
/>
|
|
373
378
|
</MenuWrapper>
|
|
374
379
|
)}
|
|
375
|
-
|
|
380
|
+
{isPreOrderSetting && showOrderTime && (
|
|
381
|
+
<OrderTimeWrapper>
|
|
382
|
+
<OText
|
|
383
|
+
size={16}
|
|
384
|
+
style={{
|
|
385
|
+
fontWeight: '600',
|
|
386
|
+
lineHeight: 24
|
|
387
|
+
}}
|
|
388
|
+
>
|
|
389
|
+
{t('ORDER_TIME', 'Order time')}
|
|
390
|
+
</OText>
|
|
391
|
+
<View style={{ flex: 1 }}>
|
|
392
|
+
{selectDate && datesWhitelist[0]?.start !== null && (
|
|
393
|
+
<CalendarStrip
|
|
394
|
+
scrollable
|
|
395
|
+
style={styles.calendar}
|
|
396
|
+
calendarHeaderContainerStyle={styles.calendarHeaderContainer}
|
|
397
|
+
calendarHeaderStyle={styles.calendarHeader}
|
|
398
|
+
dateNumberStyle={styles.dateNumber}
|
|
399
|
+
dateNameStyle={styles.dateName}
|
|
400
|
+
iconContainer={{ flex: 0.1 }}
|
|
401
|
+
highlightDateNameStyle={styles.highlightDateName}
|
|
402
|
+
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
403
|
+
dayContainerStyle={{ height: '100%' }}
|
|
404
|
+
highlightDateContainerStyle={{ height: '100%' }}
|
|
405
|
+
calendarHeaderFormat='MMMM, YYYY'
|
|
406
|
+
iconStyle={{ borderWidth: 1 }}
|
|
407
|
+
selectedDate={selectDate}
|
|
408
|
+
datesWhitelist={datesWhitelist}
|
|
409
|
+
disabledDateNameStyle={styles.disabledDateName}
|
|
410
|
+
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
411
|
+
disabledDateOpacity={0.6}
|
|
412
|
+
onDateSelected={(date) => onSelectDate(date)}
|
|
413
|
+
leftSelector={<LeftSelector />}
|
|
414
|
+
rightSelector={<RightSelector />}
|
|
415
|
+
/>
|
|
416
|
+
)}
|
|
417
|
+
</View>
|
|
418
|
+
<TimeListWrapper nestedScrollEnabled={true}>
|
|
419
|
+
{(isEnabled && timeList?.length > 0) ? (
|
|
420
|
+
<TimeContentWrapper>
|
|
421
|
+
{timeList.map((time: any, i: number) => (
|
|
422
|
+
<TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
|
|
423
|
+
<TimeItem active={timeSelected === time.value}>
|
|
424
|
+
<OText
|
|
425
|
+
size={14}
|
|
426
|
+
color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
427
|
+
style={{
|
|
428
|
+
lineHeight: 24
|
|
429
|
+
}}
|
|
430
|
+
>{time.text}</OText>
|
|
431
|
+
</TimeItem>
|
|
432
|
+
</TouchableOpacity>
|
|
433
|
+
))}
|
|
434
|
+
{timeList.length % 3 === 2 && (
|
|
435
|
+
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
436
|
+
)}
|
|
437
|
+
</TimeContentWrapper>
|
|
438
|
+
) : (
|
|
439
|
+
<OText
|
|
440
|
+
size={16}
|
|
441
|
+
style={{
|
|
442
|
+
fontWeight: '600',
|
|
443
|
+
lineHeight: 24,
|
|
444
|
+
marginBottom: 12,
|
|
445
|
+
textAlign: 'center'
|
|
446
|
+
}}
|
|
447
|
+
>
|
|
448
|
+
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
449
|
+
</OText>
|
|
450
|
+
)}
|
|
451
|
+
</TimeListWrapper>
|
|
452
|
+
</OrderTimeWrapper>
|
|
453
|
+
)}
|
|
454
|
+
{!isPreOrderSetting && (
|
|
376
455
|
<OText
|
|
377
456
|
size={16}
|
|
378
457
|
style={{
|
|
379
458
|
fontWeight: '600',
|
|
380
|
-
lineHeight: 24
|
|
459
|
+
lineHeight: 24,
|
|
460
|
+
marginTop: 30,
|
|
461
|
+
marginBottom: 12,
|
|
462
|
+
textAlign: 'center'
|
|
381
463
|
}}
|
|
382
|
-
|
|
383
|
-
{t('
|
|
464
|
+
>
|
|
465
|
+
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
384
466
|
</OText>
|
|
385
|
-
|
|
386
|
-
{selectDate && datesWhitelist[0]?.start !== null && (
|
|
387
|
-
<CalendarStrip
|
|
388
|
-
scrollable
|
|
389
|
-
style={styles.calendar}
|
|
390
|
-
calendarHeaderContainerStyle={styles.calendarHeaderContainer}
|
|
391
|
-
calendarHeaderStyle={styles.calendarHeader}
|
|
392
|
-
dateNumberStyle={styles.dateNumber}
|
|
393
|
-
dateNameStyle={styles.dateName}
|
|
394
|
-
iconContainer={{ flex: 0.1 }}
|
|
395
|
-
highlightDateNameStyle={styles.highlightDateName}
|
|
396
|
-
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
397
|
-
dayContainerStyle={{ height: '100%' }}
|
|
398
|
-
highlightDateContainerStyle={{ height: '100%' }}
|
|
399
|
-
calendarHeaderFormat='MMMM, YYYY'
|
|
400
|
-
iconStyle={{ borderWidth: 1 }}
|
|
401
|
-
selectedDate={selectDate}
|
|
402
|
-
datesWhitelist={datesWhitelist}
|
|
403
|
-
disabledDateNameStyle={styles.disabledDateName}
|
|
404
|
-
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
405
|
-
disabledDateOpacity={0.6}
|
|
406
|
-
onDateSelected={(date) => onSelectDate(date)}
|
|
407
|
-
leftSelector={<LeftSelector />}
|
|
408
|
-
rightSelector={<RightSelector />}
|
|
409
|
-
/>
|
|
410
|
-
)}
|
|
411
|
-
</View>
|
|
412
|
-
<TimeListWrapper nestedScrollEnabled={true}>
|
|
413
|
-
{(isEnabled && timeList?.length > 0) ? (
|
|
414
|
-
<TimeContentWrapper>
|
|
415
|
-
{timeList.map((time: any, i: number) => (
|
|
416
|
-
<TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
|
|
417
|
-
<TimeItem active={timeSelected === time.value}>
|
|
418
|
-
<OText
|
|
419
|
-
size={14}
|
|
420
|
-
color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
421
|
-
style={{
|
|
422
|
-
lineHeight: 24
|
|
423
|
-
}}
|
|
424
|
-
>{time.text}</OText>
|
|
425
|
-
</TimeItem>
|
|
426
|
-
</TouchableOpacity>
|
|
427
|
-
))}
|
|
428
|
-
{timeList.length % 3 === 2 && (
|
|
429
|
-
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
430
|
-
)}
|
|
431
|
-
</TimeContentWrapper>
|
|
432
|
-
) : (
|
|
433
|
-
<OText
|
|
434
|
-
size={16}
|
|
435
|
-
style={{
|
|
436
|
-
fontWeight: '600',
|
|
437
|
-
lineHeight: 24,
|
|
438
|
-
marginBottom: 12,
|
|
439
|
-
textAlign: 'center'
|
|
440
|
-
}}
|
|
441
|
-
>
|
|
442
|
-
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
443
|
-
</OText>
|
|
444
|
-
)}
|
|
445
|
-
</TimeListWrapper>
|
|
446
|
-
</OrderTimeWrapper>
|
|
467
|
+
)}
|
|
447
468
|
<OButton
|
|
448
469
|
text={t('GO_TO_MENU', 'Go to menu')}
|
|
449
470
|
textStyle={{ color: 'white' }}
|
|
@@ -44,11 +44,11 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
44
44
|
borderTopStartRadius: 4,
|
|
45
45
|
borderTopEndRadius: 4,
|
|
46
46
|
backgroundColor: theme.colors.textPrimary,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
},
|
|
48
|
+
tabDeactived: {
|
|
49
49
|
marginTop: 10,
|
|
50
50
|
height: 4
|
|
51
|
-
|
|
51
|
+
}
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const handleCategoryScroll = (category: any) => {
|
|
@@ -111,8 +111,10 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
111
111
|
categories.length &&
|
|
112
112
|
categories.map((category: any) => (
|
|
113
113
|
<Tab
|
|
114
|
-
key={category.
|
|
115
|
-
onPress={() =>
|
|
114
|
+
key={category.id}
|
|
115
|
+
onPress={() => requestAnimationFrame(() => {
|
|
116
|
+
handleCategoryScroll(category)
|
|
117
|
+
})}
|
|
116
118
|
style={[
|
|
117
119
|
category.id === 'featured' && !featured && styles.featuredStyle,
|
|
118
120
|
{
|
|
@@ -44,7 +44,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
|
-
<ProductsContainer>
|
|
47
|
+
<ProductsContainer renderToHardwareTextureAndroid={categoryState.loading || isBusinessLoading}>
|
|
48
48
|
{category.id &&
|
|
49
49
|
categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
|
|
50
50
|
<SingleProductCard
|
|
@@ -101,7 +101,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
101
101
|
>
|
|
102
102
|
<View style={bpStyles.catIcon}>
|
|
103
103
|
<OIcon
|
|
104
|
-
url={optimizeImage(category.image, '
|
|
104
|
+
url={optimizeImage(category.image, 'h_250,c_limit')}
|
|
105
105
|
width={41}
|
|
106
106
|
height={41}
|
|
107
107
|
style={{ borderRadius: 7.6 }}
|
|
@@ -237,7 +237,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
237
237
|
};
|
|
238
238
|
|
|
239
239
|
const bpStyles = StyleSheet.create({
|
|
240
|
-
catWrap: { flexDirection: 'row', alignItems: 'center',
|
|
240
|
+
catWrap: { flexDirection: 'row', alignItems: 'center', marginBottom: 19 },
|
|
241
241
|
catIcon: {
|
|
242
242
|
borderRadius: 7.6,
|
|
243
243
|
shadowColor: '#000000',
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
useSession,
|
|
9
9
|
useUtils,
|
|
10
10
|
ToastType,
|
|
11
|
-
useToast
|
|
11
|
+
useToast,
|
|
12
|
+
useConfig
|
|
12
13
|
} from 'ordering-components/native'
|
|
13
14
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
14
15
|
import { BusinessBasicInformation } from '../BusinessBasicInformation'
|
|
@@ -52,7 +53,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
52
53
|
const [orderState] = useOrder()
|
|
53
54
|
const [{ parsePrice }] = useUtils()
|
|
54
55
|
const [, { showToast }] = useToast()
|
|
55
|
-
|
|
56
|
+
const [{ configs }] = useConfig()
|
|
57
|
+
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
56
58
|
const styles = StyleSheet.create({
|
|
57
59
|
mainContainer: {
|
|
58
60
|
flex: 1,
|
|
@@ -70,6 +72,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
70
72
|
borderWidth: 0,
|
|
71
73
|
backgroundColor: theme.colors.clear,
|
|
72
74
|
shadowColor: theme.colors.clear,
|
|
75
|
+
padding: 40,
|
|
73
76
|
},
|
|
74
77
|
searchIcon: {
|
|
75
78
|
borderWidth: 0,
|
|
@@ -96,24 +99,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
const onProductClick = (product: any) => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
productCart: cartProduct,
|
|
105
|
-
businessSlug: business?.slug,
|
|
106
|
-
categoryId: cartProduct?.category_id,
|
|
107
|
-
productId: cartProduct?.id,
|
|
108
|
-
})
|
|
109
|
-
} else {
|
|
110
|
-
onRedirect('ProductDetails', {
|
|
111
|
-
product: product,
|
|
112
|
-
businessSlug: business.slug,
|
|
113
|
-
businessId: business.id,
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
|
|
102
|
+
onRedirect('ProductDetails', {
|
|
103
|
+
product: product,
|
|
104
|
+
businessSlug: business.slug,
|
|
105
|
+
businessId: business.id,
|
|
106
|
+
})
|
|
117
107
|
}
|
|
118
108
|
|
|
119
109
|
const handleCancel = () => {
|
|
@@ -167,8 +157,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
167
157
|
|
|
168
158
|
const handleTouchDrag = useCallback(() => {
|
|
169
159
|
setCategoryClicked(false);
|
|
170
|
-
|
|
171
|
-
|
|
160
|
+
}, []);
|
|
161
|
+
|
|
172
162
|
const handleBackNavigation = () => {
|
|
173
163
|
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
174
164
|
}
|
|
@@ -231,6 +221,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
231
221
|
openBusinessInformation={openBusinessInformation}
|
|
232
222
|
header={header}
|
|
233
223
|
logo={logo}
|
|
224
|
+
isPreOrder={isPreOrder}
|
|
234
225
|
/>
|
|
235
226
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
236
227
|
{!loading && business?.id && (
|
|
@@ -248,7 +239,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
248
239
|
selectedCategoryId={selectedCategoryId}
|
|
249
240
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
250
241
|
setSelectedCategoryId={setSelectedCategoryId}
|
|
251
|
-
|
|
242
|
+
setCategoryClicked={setCategoryClicked}
|
|
252
243
|
/>
|
|
253
244
|
)}
|
|
254
245
|
</>
|
|
@@ -307,16 +298,18 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
307
298
|
{!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
|
|
308
299
|
<FloatingButton
|
|
309
300
|
btnText={
|
|
310
|
-
|
|
311
|
-
? t('
|
|
312
|
-
:
|
|
301
|
+
openUpselling
|
|
302
|
+
? t('LOADING', 'Loading')
|
|
303
|
+
: currentCart?.subtotal >= currentCart?.minimum
|
|
304
|
+
? t('VIEW_ORDER', 'View Order')
|
|
305
|
+
: `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
|
|
313
306
|
}
|
|
314
|
-
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum}
|
|
307
|
+
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
315
308
|
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
316
309
|
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
317
310
|
btnLeftValue={currentCart?.products?.length}
|
|
318
311
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
319
|
-
disabled={currentCart?.subtotal < currentCart?.minimum}
|
|
312
|
+
disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
320
313
|
handleClick={() => setOpenUpselling(true)}
|
|
321
314
|
/>
|
|
322
315
|
)}
|
|
@@ -326,13 +319,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
326
319
|
business={currentCart?.business}
|
|
327
320
|
cartProducts={currentCart?.products}
|
|
328
321
|
cart={currentCart}
|
|
329
|
-
|
|
322
|
+
setOpenUpselling={setOpenUpselling}
|
|
330
323
|
handleUpsellingPage={handleUpsellingPage}
|
|
331
324
|
handleCloseUpsellingPage={handleCloseUpsellingPage}
|
|
332
325
|
openUpselling={openUpselling}
|
|
333
326
|
canOpenUpselling={canOpenUpselling}
|
|
334
327
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
335
|
-
|
|
328
|
+
onRedirect={onRedirect}
|
|
336
329
|
/>
|
|
337
330
|
)}
|
|
338
331
|
</SafeAreaView>
|
|
@@ -90,33 +90,12 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
90
90
|
</View>
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
-
const ReviewItem = ({ comment, created_at, total
|
|
93
|
+
const ReviewItem = ({ comment, created_at, total }: any) => (
|
|
94
94
|
<View style={{ marginBottom: 30 }}>
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
<OIcon
|
|
98
|
-
url={theme.images.dummies.customerPhoto}
|
|
99
|
-
width={38}
|
|
100
|
-
height={38}
|
|
101
|
-
style={{
|
|
102
|
-
borderRadius: 7.6,
|
|
103
|
-
borderWidth: 1,
|
|
104
|
-
borderColor: theme.colors.border,
|
|
105
|
-
marginEnd: 9,
|
|
106
|
-
}}
|
|
107
|
-
/>
|
|
108
|
-
<View>
|
|
109
|
-
<OText size={12} color={theme.colors.textNormal} weight={'500'}>
|
|
110
|
-
{customer?.name || 'Jane Cooper'}
|
|
111
|
-
</OText>
|
|
112
|
-
<OText size={10} color={theme.colors.textSecondary}>
|
|
113
|
-
{moment(created_at).format('MMMM d, yyyy • hh:mm')}
|
|
114
|
-
</OText>
|
|
115
|
-
</View>
|
|
116
|
-
</View>
|
|
117
|
-
<OText size={10} color={theme.colors.textNormal}>
|
|
118
|
-
{comment}
|
|
95
|
+
<OText size={12} color={theme.colors.textSecondary}>
|
|
96
|
+
{moment(created_at).format('MMMM d, yyyy • hh:mm')}
|
|
119
97
|
</OText>
|
|
98
|
+
<OText size={12} color={theme.colors.textNormal}>{comment}</OText>
|
|
120
99
|
</View>
|
|
121
100
|
);
|
|
122
101
|
|
|
@@ -237,9 +216,10 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
237
216
|
))}
|
|
238
217
|
</>
|
|
239
218
|
)}
|
|
240
|
-
{
|
|
241
|
-
|
|
242
|
-
|
|
219
|
+
{reviewsList?.reviews
|
|
220
|
+
.filter((review: any) => searchReview !== '' ? review.comment?.toLowerCase()?.includes(searchReview?.toLowerCase()) : true).length === 0 && (
|
|
221
|
+
<OText>{t('REVIEWS_NOT_FOUND', 'Reviews Not Found')}</OText>
|
|
222
|
+
)}
|
|
243
223
|
</BusinessReviewContent>
|
|
244
224
|
</BusinessReviewsContainer>
|
|
245
225
|
);
|
|
@@ -61,7 +61,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
61
61
|
handleChangeSearch,
|
|
62
62
|
businessId
|
|
63
63
|
} = props;
|
|
64
|
-
|
|
65
64
|
const theme = useTheme();
|
|
66
65
|
const isFocused = useIsFocused();
|
|
67
66
|
const appState = useRef(AppState.currentState)
|
|
@@ -120,7 +119,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
120
119
|
|
|
121
120
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
122
121
|
Number(configs?.max_days_preorder?.value) > 0
|
|
123
|
-
|
|
122
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
124
123
|
const timerId = useRef<any>(false)
|
|
125
124
|
// const panResponder = useRef(
|
|
126
125
|
// PanResponder.create({
|
|
@@ -166,25 +165,22 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
166
165
|
return R * c
|
|
167
166
|
}
|
|
168
167
|
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
if (businessesList.businesses.length > 0) {
|
|
171
|
-
const fb = businessesList.businesses.filter((b) => b.featured == true);
|
|
172
|
-
const ary = [];
|
|
173
|
-
while (fb.length > 0) {
|
|
174
|
-
ary.push(fb.splice(0, 2));
|
|
175
|
-
}
|
|
176
|
-
setFeaturedBusinesses(ary);
|
|
177
|
-
}
|
|
178
|
-
}, [businessesList.businesses]);
|
|
179
|
-
|
|
180
168
|
const resetInactivityTimeout = () => {
|
|
181
169
|
clearTimeout(timerId.current)
|
|
182
170
|
timerId.current = setInterval(() => {
|
|
183
171
|
getBusinesses(true)
|
|
184
|
-
},
|
|
172
|
+
}, 120000)
|
|
185
173
|
}
|
|
186
174
|
|
|
187
175
|
useEffect(() => {
|
|
176
|
+
if (!businessesList?.loading) {
|
|
177
|
+
const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
|
|
178
|
+
const ary = [];
|
|
179
|
+
while (fb.length > 0) {
|
|
180
|
+
ary.push(fb.splice(0, 2));
|
|
181
|
+
}
|
|
182
|
+
setFeaturedBusinesses(ary);
|
|
183
|
+
}
|
|
188
184
|
resetInactivityTimeout()
|
|
189
185
|
}, [businessesList.loading])
|
|
190
186
|
|
|
@@ -207,27 +203,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
207
203
|
})
|
|
208
204
|
}, [orderState?.options?.address?.location])
|
|
209
205
|
|
|
210
|
-
useEffect(() => {
|
|
211
|
-
const onFocusApp = (nextAppState: any) => {
|
|
212
|
-
if (
|
|
213
|
-
appState.current.match(/inactive|background/) &&
|
|
214
|
-
nextAppState === "active"
|
|
215
|
-
) {
|
|
216
|
-
getBusinesses(true);
|
|
217
|
-
}
|
|
218
|
-
appState.current = nextAppState;
|
|
219
|
-
setAppStateVisible(appState.current);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
AppState.addEventListener("change", onFocusApp);
|
|
223
|
-
return () => {
|
|
224
|
-
AppState.removeEventListener('change', onFocusApp);
|
|
225
|
-
};
|
|
226
|
-
}, [])
|
|
227
|
-
|
|
228
206
|
useFocusEffect(
|
|
229
207
|
useCallback(() => {
|
|
230
|
-
getBusinesses(true)
|
|
231
208
|
resetInactivityTimeout()
|
|
232
209
|
return () => clearTimeout(timerId.current)
|
|
233
210
|
}, [navigation])
|
|
@@ -288,25 +265,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
288
265
|
style={{ marginStart: 8 }}
|
|
289
266
|
/>
|
|
290
267
|
</WrapMomentOption>
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
268
|
+
{isPreOrderSetting && (
|
|
269
|
+
<WrapMomentOption
|
|
270
|
+
onPress={() => handleMomentClick()}>
|
|
271
|
+
<OText
|
|
272
|
+
size={12}
|
|
273
|
+
numberOfLines={1}
|
|
274
|
+
ellipsizeMode="tail"
|
|
275
|
+
color={theme.colors.textSecondary}>
|
|
276
|
+
{orderState.options?.momentß
|
|
277
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
278
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
279
|
+
</OText>
|
|
280
|
+
{isPreorderEnabled && (
|
|
281
|
+
<OIcon
|
|
282
|
+
src={theme.images.general.arrow_down}
|
|
283
|
+
width={10}
|
|
284
|
+
style={{ marginStart: 8 }}
|
|
285
|
+
/>
|
|
286
|
+
)}
|
|
287
|
+
</WrapMomentOption>
|
|
288
|
+
)}
|
|
310
289
|
|
|
311
290
|
{!businessId && (
|
|
312
291
|
<SearchBar
|
|
@@ -401,6 +380,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
401
380
|
handleCustomClick={handleBusinessClick}
|
|
402
381
|
orderType={orderState?.options?.type}
|
|
403
382
|
navigation={navigation}
|
|
383
|
+
businessHeader={business?.header}
|
|
384
|
+
businessFeatured={business?.featured}
|
|
385
|
+
businessLogo={business?.logo}
|
|
386
|
+
businessReviews={business?.reviews}
|
|
387
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
388
|
+
businessDeliveryTime={business?.delivery_time}
|
|
389
|
+
businessPickupTime={business?.pickup_time}
|
|
390
|
+
businessDistance={business?.distance}
|
|
404
391
|
/>
|
|
405
392
|
)
|
|
406
393
|
)}
|