ordering-ui-react-native 0.16.72-release → 0.16.73-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.
Files changed (48) hide show
  1. package/package.json +1 -1
  2. package/src/components/OrderCreating/index.tsx +2 -2
  3. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +2 -2
  4. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  5. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  6. package/themes/business/src/components/LoginForm/index.tsx +235 -80
  7. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  8. package/themes/business/src/components/ProductItemAccordion/index.tsx +21 -3
  9. package/themes/business/src/types/index.tsx +15 -0
  10. package/themes/business/src/utils/index.tsx +16 -0
  11. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  12. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  13. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  14. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  15. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  16. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  17. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  18. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  19. package/themes/kiosk/src/types/index.d.ts +13 -0
  20. package/themes/kiosk/src/utils/index.tsx +15 -0
  21. package/themes/original/src/components/BusinessListingSearch/index.tsx +12 -7
  22. package/themes/original/src/components/BusinessProductsListing/index.tsx +1 -0
  23. package/themes/original/src/components/Cart/index.tsx +3 -2
  24. package/themes/original/src/components/Checkout/index.tsx +4 -3
  25. package/themes/original/src/components/Favorite/index.tsx +1 -1
  26. package/themes/original/src/components/Help/index.tsx +2 -2
  27. package/themes/original/src/components/HelpGuide/index.tsx +2 -2
  28. package/themes/original/src/components/HelpGuide/styles.tsx +1 -0
  29. package/themes/original/src/components/Messages/index.tsx +8 -7
  30. package/themes/original/src/components/OrderDetails/index.tsx +8 -3
  31. package/themes/original/src/components/OrderProgress/index.tsx +2 -5
  32. package/themes/original/src/components/OrdersOption/index.tsx +17 -29
  33. package/themes/original/src/components/ProductForm/index.tsx +29 -2
  34. package/themes/original/src/components/ProductOptionSubOption/index.tsx +1 -1
  35. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  36. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  37. package/themes/original/src/components/ProfessionalProfile/index.tsx +1 -1
  38. package/themes/original/src/components/ServiceForm/index.tsx +11 -3
  39. package/themes/original/src/components/Sessions/index.tsx +11 -8
  40. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  41. package/themes/original/src/components/SingleProductCard/index.tsx +62 -24
  42. package/themes/original/src/components/SingleProductCard/styles.tsx +12 -4
  43. package/themes/original/src/components/UpsellingProducts/index.tsx +3 -3
  44. package/themes/original/src/components/UserProfileForm/index.tsx +3 -1
  45. package/themes/original/src/components/UserProfileForm/styles.tsx +1 -1
  46. package/themes/original/src/components/Wallets/index.tsx +4 -3
  47. package/themes/original/src/types/index.tsx +2 -1
  48. package/themes/original/src/utils/index.tsx +12 -0
@@ -1,5 +1,18 @@
1
1
  import styled from 'styled-components/native';
2
2
 
3
+ export const LoginWith = styled.View`
4
+ display: flex;
5
+ width: 100%;
6
+ margin-bottom: 30px;
7
+ `;
8
+
9
+ export const TabsContainer = styled.View`
10
+ min-width: ${({ width }: { width: number }) => `${width}px`};
11
+ width: auto;
12
+ display: flex;
13
+ flex-direction: row;
14
+ `;
15
+
3
16
  export const LogoWrapper = styled.View`
4
17
  align-items: center;
5
18
  `;
@@ -11,4 +24,4 @@ export const RecaptchaButton = styled.View`
11
24
  flex-direction: row;
12
25
  align-items: center;
13
26
  margin-bottom: 10px;
14
- `
27
+ `
@@ -86,6 +86,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
86
86
  return (
87
87
  <Wrapper>
88
88
  <PhoneInput
89
+ containerStyle={{ width: '100%' }}
89
90
  ref={phoneInput}
90
91
  defaultValue={userphoneNumber || defaultValue}
91
92
  defaultCode={defaultCode ? transformCountryCode(defaultCode) : configs?.default_country_code?.value}
@@ -1,5 +1,3 @@
1
1
  import styled from 'styled-components/native';
2
2
 
3
- export const Wrapper = styled.View`
4
- flex: 1
5
- `
3
+ export const Wrapper = styled.View``;
@@ -95,14 +95,14 @@ const styles = StyleSheet.create({
95
95
  position: 'relative',
96
96
  width: '100%',
97
97
  },
98
- titleSection: {
99
- width: '100%',
100
- height: 30,
101
- display: 'flex',
102
- justifyContent: 'space-between',
103
- alignItems: 'center',
104
- marginBottom: 20,
105
- },
98
+ titleSection: {
99
+ width: '100%',
100
+ justifyContent: 'space-between',
101
+ alignItems: 'flex-start',
102
+ paddingLeft: 40,
103
+ paddingRight: 40,
104
+ marginBottom: 40,
105
+ },
106
106
  cancelBtn: {
107
107
  position: 'absolute',
108
108
  left: 0,
@@ -111,9 +111,12 @@ const styles = StyleSheet.create({
111
111
  },
112
112
  modalText: {
113
113
  marginTop: 15,
114
- fontSize: 25,
115
- textAlign: "center",
116
- zIndex: 10
114
+ fontSize: 20,
115
+ lineHeight: 30,
116
+ fontWeight: '600',
117
+ textAlign: "center",
118
+ zIndex: 10,
119
+ width: '100%'
117
120
  },
118
121
  wrapperIcon: {
119
122
  overflow: 'hidden',
@@ -22,7 +22,13 @@ export const Container = (props: Props) => {
22
22
  <SafeAreStyled
23
23
  nestedScrollEnabled={props.nestedScrollEnabled}
24
24
  >
25
- <ContainerStyled {...props} ref={props?.forwardRef}>{props.children}</ContainerStyled>
25
+ <ContainerStyled
26
+ {...props}
27
+ keyboardShouldPersistTaps="handled"
28
+ ref={props?.forwardRef}
29
+ >
30
+ {props.children}
31
+ </ContainerStyled>
26
32
  </SafeAreStyled>
27
33
  );
28
34
  };
@@ -84,6 +84,12 @@ export interface LoginParams {
84
84
  useRootPoint?: any;
85
85
  enableReCaptcha?: boolean;
86
86
  handleReCaptcha?: (vlaue: any) => void;
87
+ useLoginOtp?: any;
88
+ otpType?: any;
89
+ setOtpType?: any;
90
+ generateOtpCode?: any;
91
+ useLoginOtpEmail?: any;
92
+ useLoginOtpCellphone?: any;
87
93
  }
88
94
 
89
95
  export interface ProductItemAccordionParams {
@@ -482,3 +488,10 @@ export interface Cart {
482
488
  export interface NoNetworkParams {
483
489
  image?: any;
484
490
  }
491
+ export interface otpParams {
492
+ willVerifyOtpState: boolean,
493
+ setWillVerifyOtpState: (val : boolean) => void,
494
+ onSubmit: any,
495
+ handleLoginOtp: (code : string) => void,
496
+ setAlertState: any
497
+ }
@@ -0,0 +1,15 @@
1
+ export const formatSeconds = (seconds : number) => {
2
+ // Hours, minutes and seconds
3
+ const hrs = Math.floor(seconds / 3600)
4
+ const mins = Math.floor((seconds % 3600) / 60)
5
+ const secs = Math.floor(seconds % 60)
6
+
7
+ // Output like '1:01' or '4:03:59' or '123:03:59'
8
+ let ret = ''
9
+ if (hrs > 0) {
10
+ ret += '' + hrs + ':' + (mins < 10 ? '0' : '')
11
+ }
12
+ ret += '' + mins + ':' + (secs < 10 ? '0' : '')
13
+ ret += '' + secs
14
+ return ret
15
+ }
@@ -240,13 +240,16 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
240
240
  <SearchBar
241
241
  lazyLoad
242
242
  {...(isChewLayout && { height: 55 })}
243
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
244
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
243
+ inputStyle={{ ...styles.searchInput }}
244
+ placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
245
245
  onSearch={(val: string) => handleChangeTermValue(val)}
246
246
  value={termValue}
247
247
  iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
248
248
  />
249
249
  </SearchWrapper>
250
+ <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
251
+ {t('TYPE_AT_LEAST_3_CHARACTERS', 'Type at least 3 characters')}
252
+ </OText>
250
253
  {
251
254
  noResults && (
252
255
  <View>
@@ -273,11 +276,13 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
273
276
  />
274
277
  )}
275
278
 
276
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
277
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
278
- {t('BUSINESSES', 'Businesses')}
279
- </OText>
280
- </OptionTitle>
279
+ {businessesSearchList.businesses?.length > 0 && (
280
+ <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
281
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
282
+ {t('BUSINESSES', 'Businesses')}
283
+ </OText>
284
+ </OptionTitle>
285
+ )}
281
286
  <ScrollView horizontal showsHorizontalScrollIndicator={false}>
282
287
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
283
288
  <View
@@ -447,6 +447,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
447
447
  professionals={business?.professionals}
448
448
  professionalSelected={professionalSelected}
449
449
  handleChangeProfessionalSelected={handleChangeProfessionalSelected}
450
+ handleUpdateProfessionals={handleUpdateProfessionals}
450
451
  />
451
452
  </ProfessionalFilterWrapper>
452
453
  )}
@@ -409,12 +409,13 @@ const CartUI = (props: any) => {
409
409
  uuid={cart?.uuid}
410
410
  businessId={cart?.business_id}
411
411
  driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
412
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
412
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
413
413
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
414
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
414
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
415
415
  ? cart?.driver_tip
416
416
  : cart?.driver_tip_rate}
417
417
  useOrderContext
418
+ cart={cart}
418
419
  />
419
420
  </DriverTipsContainer>
420
421
  )}
@@ -303,7 +303,7 @@ const CheckoutUI = (props: any) => {
303
303
  titleAlign={'center'}
304
304
  onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
305
305
  showCall={false}
306
- btnStyle={{ paddingLeft: 0 }}
306
+ btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
307
307
  titleWrapStyle={{ paddingHorizontal: 0 }}
308
308
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
309
309
  />
@@ -540,12 +540,13 @@ const CheckoutUI = (props: any) => {
540
540
  uuid={cartUuid}
541
541
  businessId={cart?.business_id}
542
542
  driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
543
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
543
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
544
544
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
545
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
545
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
546
546
  ? cart?.driver_tip
547
547
  : cart?.driver_tip_rate}
548
548
  useOrderContext
549
+ cart={cart}
549
550
  />
550
551
  </ChDriverTips>
551
552
  </ChSection>
@@ -35,7 +35,7 @@ export const Favorite = (props: any) => {
35
35
 
36
36
  return (
37
37
  <Container
38
- pdng={Platform.OS === 'ios' ? '20px' : '30px'}
38
+ pdng={Platform.OS === 'ios' ? '10px' : '20px'}
39
39
  >
40
40
  <NavBar
41
41
  title={t('FAVORITE', 'Favorite')}
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { RefreshControl } from 'react-native'
2
+ import { Platform, RefreshControl } from 'react-native'
3
3
  import { HelpParams } from '../../types'
4
4
  import { useLanguage } from 'ordering-components/native'
5
5
  import NavBar from '../NavBar'
@@ -31,7 +31,7 @@ export const Help = (props: HelpParams) => {
31
31
 
32
32
  return (
33
33
  <Container
34
- pt={10}
34
+ pt={Platform.OS === 'ios' ? 20 : 10}
35
35
  noPadding
36
36
  refreshControl={
37
37
  <RefreshControl
@@ -3,7 +3,7 @@ import { useLanguage } from 'ordering-components/native'
3
3
  import { HelpGuideParams } from '../../types'
4
4
  import { OText, OIcon } from '../shared'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { StyleSheet } from 'react-native'
6
+ import { Platform, StyleSheet } from 'react-native'
7
7
  import NavBar from '../NavBar'
8
8
  import {
9
9
  Content,
@@ -37,7 +37,7 @@ export const HelpGuide = (props: HelpGuideParams) => {
37
37
  const goToBack = () => navigation?.canGoBack() && navigation.goBack()
38
38
 
39
39
  return (
40
- <Container>
40
+ <Container pdng={Platform.OS === 'ios' ? '10px' : '0px'}>
41
41
  <NavBar
42
42
  title={t('GUIDE_TO_ORDERING', 'Guide to Ordering')}
43
43
  onActionLeft={goToBack}
@@ -8,4 +8,5 @@ export const Container = styled.ScrollView`
8
8
  position: relative;
9
9
  flex: 1;
10
10
  margin: 10px 0;
11
+ padding-top: ${(props: any) => props.pdng}
11
12
  `
@@ -13,6 +13,7 @@ import { Header, TitleHeader, Wrapper, QuickMessageContainer, ProfileMessageHead
13
13
  import { MessagesParams } from '../../types'
14
14
  import { useWindowDimensions } from 'react-native'
15
15
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
16
+ import { getLogisticTag } from '../../utils'
16
17
 
17
18
  const ORDER_STATUS: any = {
18
19
  0: 'ORDER_STATUS_PENDING',
@@ -127,7 +128,7 @@ const MessagesUI = (props: MessagesParams) => {
127
128
  ?
128
129
  `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
129
130
  `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
130
- `${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
131
+ `${message.change?.attribute !== 'logistic_status' ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)]) : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status' ? t(ORDER_STATUS[parseInt(message.change.new, 10)]) : getLogisticTag(message.change.new)}`
131
132
  }`
132
133
  : message.change.new
133
134
  ?
@@ -155,9 +156,9 @@ const MessagesUI = (props: MessagesParams) => {
155
156
  image: message.source,
156
157
  system: message.type === 1,
157
158
  user: {
158
- _id: message.author.id,
159
- name: message.author.name,
160
- avatar: message.author.id !== user.id && type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo
159
+ _id: message.author && message.author.id,
160
+ name: message.author && message.author.name,
161
+ avatar: message.author && (message.author.id !== user.id && type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo)
161
162
  }
162
163
  });
163
164
  }
@@ -170,9 +171,9 @@ const MessagesUI = (props: MessagesParams) => {
170
171
  image: message.source,
171
172
  system: message.type === 1,
172
173
  user: {
173
- _id: message.author.id,
174
- name: message.author.name,
175
- avatar: message.author.id !== user.id && type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo
174
+ _id: message.author && message.author.id ,
175
+ name: message.author && message.author.name,
176
+ avatar: message.author && (message.author.id !== user.id && type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo)
176
177
  }
177
178
  });
178
179
  }
@@ -118,6 +118,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
118
118
  const mapValidStatuses = [9, 19, 23]
119
119
  const placeSpotTypes = [3, 4, 5]
120
120
  const directionTypes = [2, 3, 4, 5]
121
+ const activeStatus = [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
121
122
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
122
123
 
123
124
  const walletName: any = {
@@ -396,9 +397,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
396
397
  titleWrapStyle={{ paddingHorizontal: 0 }}
397
398
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
398
399
  subTitle={<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
399
- {order?.delivery_datetime_utc
400
- ? parseDate(order?.delivery_datetime_utc)
401
- : parseDate(order?.delivery_datetime, { utc: false })}
400
+ {
401
+ activeStatus.includes(order?.status)
402
+ ? order?.eta_time + 'min'
403
+ : order?.delivery_datetime_utc
404
+ ? parseDate(order?.delivery_datetime_utc)
405
+ : parseDate(order?.delivery_datetime, { utc: false })
406
+ }
402
407
  </OText>}
403
408
  />
404
409
  {enabledPoweredByOrdering && (
@@ -77,14 +77,11 @@ const OrderProgressUI = (props: any) => {
77
77
  });
78
78
 
79
79
  const convertDiffToHours = (order: any) => {
80
- const time = order.delivery_type === 1 ? order?.business?.delivery_time : order?.business?.pickup_time
80
+ const minute = order?.eta_time
81
81
  const deliveryTime = order?.delivery_datetime_utc
82
82
  ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm' })
83
83
  : parseDate(order?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD HH:mm' })
84
- const hour = time?.split(':')?.[0]
85
- const minute = time?.split(':')?.[1]
86
- const result = time ? (parseInt(hour, 10) * 60) + parseInt(minute, 10) : 0
87
- const returnedDate = moment(deliveryTime).add(result, 'minutes').format('hh:mm A')
84
+ const returnedDate = moment(deliveryTime).add(minute, 'minutes').format('hh:mm A')
88
85
  return returnedDate
89
86
  }
90
87
 
@@ -3,7 +3,6 @@ import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useFocusEffect } from '@react-navigation/native'
5
5
  import { OText, OButton } from '../shared'
6
- import { NotFoundSource } from '../NotFoundSource'
7
6
  import { ActiveOrders } from '../ActiveOrders'
8
7
  import { PreviousOrders } from '../PreviousOrders'
9
8
  import { PreviousBusinessOrdered } from './PreviousBusinessOrdered'
@@ -73,22 +72,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
73
72
  useEffect(() => {
74
73
  if (loading || error) return
75
74
  const ordersReduced = _orders.map((order: any) => order?.cart_group_id
76
- ? _orders
77
- .filter((_order: any) => _order?.cart_group_id === order?.cart_group_id)
78
- .map((_o: any, _: any, _ordersList: any) => {
79
- const obj = {
80
- ..._o,
81
- id: _ordersList.map(o => o.id),
82
- review: _o.review,
83
- user_review: _o.user_review,
84
- total: _ordersList.reduce((acc: any, o: any) => acc + o.summary.total, 0),
85
- business: _ordersList.map((o: any) => o.business),
86
- business_id: _ordersList.map((o: any) => o.business_id),
87
- products: _ordersList.map((o: any) => o.products)
88
- }
89
- return obj
90
- }).find((o: any) => o)
91
- : order)
75
+ ? _orders
76
+ .filter((_order: any) => _order?.cart_group_id === order?.cart_group_id)
77
+ .map((_o: any, _: any, _ordersList: any) => {
78
+ const obj = {
79
+ ..._o,
80
+ id: _ordersList.map(o => o.id),
81
+ review: _o.review,
82
+ user_review: _o.user_review,
83
+ total: _ordersList.reduce((acc: any, o: any) => acc + o.summary.total, 0),
84
+ business: _ordersList.map((o: any) => o.business),
85
+ business_id: _ordersList.map((o: any) => o.business_id),
86
+ products: _ordersList.map((o: any) => o.products)
87
+ }
88
+ return obj
89
+ }).find((o: any) => o)
90
+ : order)
92
91
  const orders = ordersReduced?.filter((order: any) => {
93
92
  if (!order?.cart_group_id) return true
94
93
  const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
@@ -193,7 +192,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
193
192
 
194
193
  </NoOrdersWrapper>
195
194
  )}
196
- {(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
195
+ {((ordersLength?.activeOrdersLength > 0 && activeOrders) || (ordersLength?.previousOrdersLength > 0 && !activeOrders)) && (
197
196
  <>
198
197
  {((titleContent && ((isBusiness && businessOrderIds?.length > 0) || isProducts)) || !titleContent) && (
199
198
  <OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
@@ -206,17 +205,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
206
205
  </OText>
207
206
  </OptionTitle>
208
207
  )}
209
-
210
- {!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
211
- !loading &&
212
- orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
213
- (
214
- <NotFoundSource
215
- content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
216
- image={imageFails}
217
- conditioned
218
- />
219
- )}
220
208
  </>
221
209
  )}
222
210
  {isBusiness && !!businessesSearchList && businesses?.loading && (
@@ -19,8 +19,10 @@ import {
19
19
  useOrder,
20
20
  useUtils,
21
21
  ToastType,
22
- useToast
22
+ useToast,
23
+ useConfig
23
24
  } from 'ordering-components/native';
25
+ import uuid from 'react-native-uuid';
24
26
  import { useTheme } from 'styled-components/native';
25
27
  import { ProductIngredient } from '../ProductIngredient';
26
28
  import { ProductOption } from '../ProductOption';
@@ -52,6 +54,7 @@ import { ProductOptionSubOption } from '../ProductOptionSubOption';
52
54
  import { NotFoundSource } from '../NotFoundSource';
53
55
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
54
56
  import NavBar from '../NavBar';
57
+ import { orderTypeList } from '../../utils';
55
58
  const windowWidth = Dimensions.get('window').width;
56
59
 
57
60
  export const ProductOptionsUI = (props: any) => {
@@ -71,7 +74,9 @@ export const ProductOptionsUI = (props: any) => {
71
74
  handleChangeSuboptionState,
72
75
  handleChangeCommentState,
73
76
  productObject,
74
- productAddedToCartLength
77
+ productAddedToCartLength,
78
+ actionStatus,
79
+ handleCreateGuestUser
75
80
  } = props;
76
81
 
77
82
  const theme = useTheme();
@@ -178,6 +183,7 @@ export const ProductOptionsUI = (props: any) => {
178
183
  const [, t] = useLanguage();
179
184
  const [orderState] = useOrder();
180
185
  const [{ auth }] = useSession();
186
+ const [{ configs }] = useConfig()
181
187
  const { product, loading, error } = productObject;
182
188
  const [gallery, setGallery] = useState([])
183
189
  const [thumbsSwiper, setThumbsSwiper] = useState(0)
@@ -198,6 +204,9 @@ export const ProductOptionsUI = (props: any) => {
198
204
  const [isScrollAvailable, setIsScrollAvailable] = useState(null)
199
205
  const [editionsLayoutY, setEditionsLayoutY] = useState(null)
200
206
 
207
+ const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
208
+ const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
209
+
201
210
  const isError = (id: number) => {
202
211
  let bgColor = theme.colors.white;
203
212
  if (errors[`id:${id}`]) {
@@ -294,6 +303,11 @@ export const ProductOptionsUI = (props: any) => {
294
303
  }
295
304
  }
296
305
 
306
+ const handleUpdateGuest = () => {
307
+ const guestToken = uuid.v4()
308
+ if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
309
+ }
310
+
297
311
  const handleOnLayout = (event: any, optionId: any) => {
298
312
  const _optionLayout = { ...optionLayout }
299
313
  const optionKey = 'id:' + optionId
@@ -472,9 +486,22 @@ export const ProductOptionsUI = (props: any) => {
472
486
  height: 44,
473
487
  borderColor: theme.colors.primary,
474
488
  backgroundColor: theme.colors.white,
489
+ paddingLeft: 0,
490
+ paddingRight: 0
475
491
  }}
476
492
  />
477
493
  )}
494
+ {!auth && guestCheckoutEnabled && orderTypeEnabled && (
495
+ <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
496
+ {actionStatus?.loading ? (
497
+ <Placeholder Animation={Fade}>
498
+ <PlaceholderLine width={60} height={20} />
499
+ </Placeholder>
500
+ ) : (
501
+ <OText color={theme.colors.primary} size={13}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
502
+ )}
503
+ </TouchableOpacity>
504
+ )}
478
505
  </View>
479
506
  )
480
507
  }
@@ -32,7 +32,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
32
32
  setIsScrollAvailable
33
33
  } = props
34
34
 
35
- const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
35
+ const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max || state.quantity === suboption?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
36
36
  const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
37
37
 
38
38
  const theme = useTheme();
@@ -0,0 +1,108 @@
1
+ import React from 'react'
2
+ import {
3
+ useSession,
4
+ useUtils,
5
+ SingleProfessionalCard as SingleProfessionalCardController
6
+ } from 'ordering-components/native'
7
+ import { useTheme } from 'styled-components/native'
8
+ import { StyleSheet, TouchableOpacity, View } from 'react-native'
9
+ import FastImage from 'react-native-fast-image'
10
+ import { OIcon, OText } from '../../shared'
11
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
12
+
13
+ const SingleProfessionalCardUI = (props) => {
14
+ const {
15
+ professional,
16
+ handleFavoriteProfessional,
17
+ active,
18
+ handleProfessionalClick
19
+ } = props
20
+
21
+ const theme = useTheme()
22
+ const [{ auth }] = useSession()
23
+ const [{ optimizeImage }] = useUtils()
24
+
25
+ const handleChangeFavorite = () => {
26
+ if (auth) {
27
+ handleFavoriteProfessional && handleFavoriteProfessional(!professional?.favorite)
28
+ }
29
+ }
30
+
31
+ const styles = StyleSheet.create({
32
+ professionalItem: {
33
+ flexDirection: 'row',
34
+ alignItems: 'center',
35
+ borderRadius: 7.6,
36
+ padding: 11,
37
+ borderWidth: 1,
38
+ marginRight: 12,
39
+ minHeight: 64
40
+ },
41
+ photoStyle: {
42
+ width: 42,
43
+ height: 42,
44
+ borderRadius: 7.6
45
+ },
46
+ favoriteIconStyle: {
47
+ width: 16,
48
+ height: 16,
49
+ },
50
+ })
51
+
52
+ return (
53
+ <TouchableOpacity
54
+ onPress={() => handleProfessionalClick(professional)}
55
+ >
56
+ <View
57
+ style={{
58
+ ...styles.professionalItem,
59
+ borderColor: active
60
+ ? theme.colors.primary
61
+ : theme.colors.border
62
+ }}
63
+ >
64
+ {professional?.photo ? (
65
+ <FastImage
66
+ style={styles.photoStyle}
67
+ source={{
68
+ uri: optimizeImage(professional?.photo, 'h_250,c_limit'),
69
+ priority: FastImage.priority.normal,
70
+ }}
71
+ resizeMode={FastImage.resizeMode.cover}
72
+ />
73
+ ) : (
74
+ <OIcon
75
+ src={theme?.images?.general?.user}
76
+ cover={false}
77
+ style={styles.photoStyle}
78
+ />
79
+ )}
80
+ <View style={{ marginLeft: 12 }}>
81
+ <OText
82
+ size={12}
83
+ weight={'400'}
84
+ >
85
+ {professional?.name} {professional?.lastname}
86
+ </OText>
87
+
88
+ <TouchableOpacity
89
+ onPress={() => handleChangeFavorite()}
90
+ >
91
+ {professional?.favorite
92
+ ? <IconAntDesign name='heart' size={16} color={theme.colors.danger5} />
93
+ : <IconAntDesign name='hearto' size={16} color={theme.colors.danger5} />
94
+ }
95
+ </TouchableOpacity>
96
+ </View>
97
+ </View>
98
+ </TouchableOpacity>
99
+ )
100
+ }
101
+
102
+ export const SingleProfessionalCard = (props) => {
103
+ const singleProfessionalCardProps = {
104
+ ...props,
105
+ UIComponent: SingleProfessionalCardUI
106
+ }
107
+ return <SingleProfessionalCardController {...singleProfessionalCardProps} />
108
+ }