ordering-ui-react-native 0.16.59 → 0.16.62

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.16.59",
3
+ "version": "0.16.62",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -36,6 +36,7 @@ export const UserFormDetailsUI = (props: any) => {
36
36
  handleCancelEdit,
37
37
  toggleIsEdit,
38
38
  isCheckout,
39
+ isAlsea
39
40
  } = props;
40
41
 
41
42
  const theme = useTheme();
@@ -265,7 +266,9 @@ export const UserFormDetailsUI = (props: any) => {
265
266
  }).map(
266
267
  (field: any) =>
267
268
  showField &&
268
- showField(field.code) && (
269
+ showField(field.code) &&
270
+ !isAlsea
271
+ && (
269
272
  <React.Fragment key={field.id}>
270
273
  <OText style={styles.label}>
271
274
  {t(field?.code.toUpperCase(), field?.name)}
@@ -442,7 +445,7 @@ export const UserFormDetailsUI = (props: any) => {
442
445
  </OText>
443
446
  )}
444
447
 
445
- {!!showInputPhoneNumber && (
448
+ {!!showInputPhoneNumber && !isAlsea && (
446
449
  <WrapperPhone>
447
450
  <PhoneInputNumber
448
451
  data={phoneInputData}
@@ -49,6 +49,7 @@ const ProfileUI = (props: ProfileParams) => {
49
49
  handleToggleAvalaibleStatusDriver,
50
50
  userState,
51
51
  isAvailableLoading,
52
+ isAlsea
52
53
  } = props;
53
54
 
54
55
  const [{ user }] = useSession();
@@ -459,6 +460,7 @@ const ProfileUI = (props: ProfileParams) => {
459
460
  hideUpdateButton
460
461
  handleCancelEdit={handleCancelEdit}
461
462
  toggleIsEdit={toggleIsEdit}
463
+ isAlsea={isAlsea}
462
464
  />
463
465
  </View>
464
466
  )}
@@ -41,6 +41,7 @@ export interface ProfileParams {
41
41
  validationFields?: any;
42
42
  showField?: any;
43
43
  isRequiredField?: any;
44
+ isAlsea?: boolean;
44
45
  }
45
46
 
46
47
  export interface AddressListParams {
@@ -7,6 +7,7 @@ import {
7
7
  useLanguage,
8
8
  useConfig,
9
9
  useToast,
10
+ useSession,
10
11
  ToastType
11
12
  } from 'ordering-components/native';
12
13
  import { OIcon, OText } from '../shared';
@@ -53,6 +54,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
53
54
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
54
55
  const [, { showToast }] = useToast()
55
56
  const [orderState] = useOrder();
57
+ const [ { auth }] = useSession()
56
58
  const [configState] = useConfig();
57
59
  const [, t] = useLanguage();
58
60
  const theme = useTheme()
@@ -135,7 +137,11 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
135
137
  }
136
138
 
137
139
  const handleChangeFavorite = () => {
138
- handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
140
+ if (auth) {
141
+ handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
142
+ } else {
143
+ navigation && navigation.navigate('Login');
144
+ }
139
145
  }
140
146
 
141
147
  return (
@@ -35,7 +35,8 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
35
35
  onClickCategory,
36
36
  lazyLoadProductsRecommended,
37
37
  handleUpdateProducts,
38
- isFiltMode
38
+ isFiltMode,
39
+ navigation
39
40
  } = props;
40
41
 
41
42
  const [, t] = useLanguage();
@@ -128,6 +129,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
128
129
  onProductClick={() => onProductClick(product)}
129
130
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
130
131
  handleUpdateProducts={handleUpdateProducts}
132
+ navigation={navigation}
131
133
  />
132
134
  ))
133
135
  }
@@ -153,6 +155,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
153
155
  onProductClick={onProductClick}
154
156
  handleUpdateProducts={handleUpdateProducts}
155
157
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
158
+ navigation={navigation}
156
159
  />
157
160
  ),
158
161
  )}
@@ -246,6 +249,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
246
249
  categoryState={categoryState}
247
250
  onProductClick={onProductClick}
248
251
  handleUpdateProducts={handleUpdateProducts}
252
+ navigation={navigation}
249
253
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
250
254
  />
251
255
  ))}
@@ -277,7 +277,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
277
277
  </WrapSearchBar>
278
278
  )}
279
279
  </TopHeader>
280
- {showBusinessNearCity && (
280
+ {showBusinessNearCity && businessState?.business?.city_id && (
281
281
  <NearBusiness>
282
282
  <BusinessesListing
283
283
  logosLayout
@@ -323,6 +323,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
323
323
  setSubcategoriesSelected={setSubcategoriesSelected}
324
324
  onClickCategory={handleChangeCategory}
325
325
  handleUpdateProducts={handleUpdateProducts}
326
+ navigation={navigation}
326
327
  isFiltMode
327
328
  />
328
329
  </View>
@@ -425,6 +426,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
425
426
  setSubcategoriesSelected={setSubcategoriesSelected}
426
427
  onClickCategory={handleChangeCategory}
427
428
  handleUpdateProducts={handleUpdateProducts}
429
+ navigation={navigation}
428
430
  />
429
431
  </WrapContent>
430
432
  </>
@@ -447,6 +449,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
447
449
  isBusinessLoading={loading}
448
450
  errorQuantityProducts={errorQuantityProducts}
449
451
  handleUpdateProducts={handleUpdateProducts}
452
+ navigation={navigation}
450
453
  />
451
454
  </WrapContent>
452
455
  </>
@@ -64,4 +64,5 @@ export const ProfessionalFilterWrapper = styled.View`
64
64
  export const NearBusiness = styled.View`
65
65
  width: 100%;
66
66
  padding-left: 20px;
67
+ max-height: 80px;
67
68
  `
@@ -133,7 +133,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
133
133
  borderRadius: 8,
134
134
  marginHorizontal: 40,
135
135
  height: 45
136
- }
136
+ },
137
+ businessSkeleton: {
138
+ borderRadius: 8,
139
+ marginRight: 20,
140
+ width: 56,
141
+ height: 56
142
+ },
137
143
  });
138
144
 
139
145
 
@@ -286,9 +292,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
286
292
  <BusinessLogosContainer horizontal>
287
293
  {businessesList?.loading ? (
288
294
  <Placeholder Animation={Fade}>
289
- {[...Array(10).keys()].map(item => (
290
- <PlaceholderLine key={item} width={56} height={56} />
291
- ))}
295
+ <View style={{ flexDirection: 'row' }}>
296
+ {[...Array(10).keys()].map(i => (
297
+ <View style={styles.businessSkeleton} key={i}>
298
+ <PlaceholderLine style={{ width: '100%', height: '100%' }} />
299
+ </View>
300
+ ))}
301
+ </View>
292
302
  </Placeholder>
293
303
  ) : (
294
304
  <>
@@ -9,6 +9,7 @@ import { OBottomPopup } from '../shared';
9
9
  import { ReviewTrigger } from '../ReviewTrigger';
10
10
 
11
11
  export const BusinessesListing = (props: any) => {
12
+ const { logosLayout } = props
12
13
  const theme = useTheme()
13
14
  const layout = theme?.layouts?.business_listing_view?.components?.layout?.type || 'original'
14
15
  const [, t] = useLanguage();
@@ -76,8 +77,8 @@ export const BusinessesListing = (props: any) => {
76
77
 
77
78
  return (
78
79
  <>
79
- {(layout === 'original') && <OriginalBusinessListing {...props} />}
80
- {(layout === 'appointment') && <AppointmentBusinessListing {...props} />}
80
+ {((layout === 'original') || logosLayout) && <OriginalBusinessListing {...props} />}
81
+ {(layout === 'appointment') && !logosLayout && <AppointmentBusinessListing {...props} />}
81
82
 
82
83
  {lastOrderReview?.isReviewOpen && (
83
84
  <OBottomPopup
@@ -141,9 +141,9 @@ const CheckoutUI = (props: any) => {
141
141
  const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
142
142
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
143
143
  const [isOpen, setIsOpen] = useState(false)
144
- const [requiredFields, setRequiredFields] = useState<any>([])
144
+ const [requiredFields, setRequiredFields] = useState<any>([])
145
145
 
146
- const placeSpotTypes = [3, 4]
146
+ const placeSpotTypes = [4]
147
147
  const businessConfigs = businessDetails?.business?.configs ?? []
148
148
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
149
149
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
@@ -178,15 +178,15 @@ const CheckoutUI = (props: any) => {
178
178
  }
179
179
  }
180
180
 
181
- const handlePlaceOrder = (confirmPayment : any) => {
181
+ const handlePlaceOrder = (confirmPayment: any) => {
182
182
  if (!userErrors.length && !requiredFields?.length) {
183
183
  handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
184
184
  return
185
185
  }
186
186
  if (requiredFields?.length) {
187
- setIsOpen(true)
188
- return
189
- }
187
+ setIsOpen(true)
188
+ return
189
+ }
190
190
  let stringError = ''
191
191
  Object.values(userErrors).map((item: any, i: number) => {
192
192
  stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
@@ -646,6 +646,7 @@ const CheckoutUI = (props: any) => {
646
646
  cart={cart}
647
647
  isCartPending={cart?.status === 2}
648
648
  onNavigationRedirect={onNavigationRedirect}
649
+ placeSpotTypes={placeSpotTypes}
649
650
  />
650
651
  </>
651
652
  )}
@@ -39,7 +39,8 @@ const OrderSummaryUI = (props: any) => {
39
39
  commentState,
40
40
  handleChangeComment,
41
41
  onNavigationRedirect,
42
- handleRemoveOfferClick
42
+ handleRemoveOfferClick,
43
+ placeSpotTypes
43
44
  } = props;
44
45
 
45
46
  const theme = useTheme()
@@ -52,7 +53,6 @@ const OrderSummaryUI = (props: any) => {
52
53
  const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
53
54
  const [openPlaceModal, setOpenPlaceModal] = useState(false)
54
55
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
55
- const placeSpotTypes = [3, 4]
56
56
 
57
57
  const handleDeleteClick = (product: any) => {
58
58
  removeProduct(product, cart)
@@ -304,7 +304,7 @@ const OrderSummaryUI = (props: any) => {
304
304
  </OSTable>
305
305
  </View>
306
306
  )}
307
- {placeSpotTypes.includes(orderState?.options?.type) && (
307
+ {placeSpotTypes && placeSpotTypes.includes(orderState?.options?.type) && (
308
308
  <OSTable style={{ marginTop: 15 }}>
309
309
  <OText size={14} lineHeight={21} weight={'600'}>
310
310
  {t('SPOT', 'Spot')}: {cart?.place?.name || t('NO_SELECTED', 'No selected')}
@@ -6,7 +6,7 @@ import {
6
6
  } from 'ordering-components/native'
7
7
  import { useTheme } from 'styled-components/native';
8
8
  import { Platform, View } from 'react-native'
9
- import { BgImage, ListWrapper, MaskCont, OrderTypeWrapper, Wrapper } from './styles'
9
+ import { BgImage, ListWrapper, MaskCont, OrderTypeWrapper, OTab, OTabs, TabBtn, Wrapper } from './styles'
10
10
  import { OrderTypeSelectParams } from '../../types'
11
11
  import { OIcon, OText } from '../shared'
12
12
  import NavBar from '../NavBar';
@@ -20,14 +20,16 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
20
20
  defaultValue,
21
21
  configTypes,
22
22
  orderTypes,
23
- setOrderTypeValue
23
+ setOrderTypeValue,
24
+ isChewLayout,
25
+ chewOrderTypes
24
26
  } = props
25
27
 
26
28
  const theme = useTheme();
27
29
  const [orderState] = useOrder();
28
30
  const [, t] = useLanguage();
29
31
  const _orderTypes = orderTypes.filter((type: any) => configTypes?.includes(type.value));
30
-
32
+
31
33
  const items = _orderTypes.map((type) => {
32
34
  return {
33
35
  value: type.value,
@@ -42,43 +44,83 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
42
44
  if (!orderState.loading) {
43
45
  setOrderTypeValue && setOrderTypeValue(orderType)
44
46
  handleChangeOrderType(orderType)
45
- goToBack();
47
+ if(!isChewLayout){
48
+ goToBack();
49
+ }
46
50
  }
47
51
  }
48
52
 
49
53
  return (
50
54
  <Wrapper>
51
- <NavBar
52
- onActionLeft={() => goToBack()}
53
- btnStyle={{ paddingLeft: 0 }}
54
- paddingTop={0}
55
- style={{ paddingBottom: 0 }}
56
- title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
57
- titleAlign={'center'}
58
- titleStyle={{ fontSize: 14 }}
59
- />
60
- {
61
- items.length > 0 && (
62
- <ListWrapper>
63
- {
64
- items && items.map((item: any, idx: number) =>
65
- <OrderTypeWrapper activeOpacity={0.8} key={idx} disabled={orderState.loading} onPress={() => handleChangeOrderTypeCallback(item.value)}>
66
- <BgImage source={theme.images.orderTypes[`type${item?.value || 1}`]} resizeMode={'cover'} style={{opacity: item?.value == typeSelected || typeSelected === undefined ? 1 : 0.4}}>
67
- <MaskCont>
68
- <OText size={12} lineHeight={18} color={theme.colors.white} weight={Platform.OS === 'android' ? 'bold' : '600'}>{item?.label}</OText>
69
- <OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
70
- <View style={{flexDirection: 'row', alignItems: 'center'}}>
71
- <OText size={10} lineHeight={15} color={theme.colors.white}>{t('START_MY_ORDER', 'Start my order')}</OText>
72
- <OIcon src={theme.images.general.arrow_left} width={16} color={theme.colors.white} style={{transform: [{ rotate: '180deg' }], marginStart: 4}} />
73
- </View>
74
- </MaskCont>
75
- </BgImage>
76
- </OrderTypeWrapper>
77
- )
78
- }
79
- </ListWrapper>
80
- )
81
- }
55
+ {isChewLayout ? (
56
+ <View>
57
+ <OTabs
58
+ horizontal
59
+ showsHorizontalScrollIndicator={false}
60
+ >
61
+ {chewOrderTypes?.map((type : any) => (
62
+ <TabBtn
63
+ key={type.value}
64
+ onPress={() => handleChangeOrderTypeCallback(type.value)}
65
+ >
66
+ <OTab
67
+ style={{
68
+ borderBottomColor:
69
+ type.value === typeSelected
70
+ ? theme.colors.textNormal
71
+ : theme.colors.border,
72
+ }}>
73
+ <OText
74
+ size={14}
75
+ color={
76
+ type.value === typeSelected
77
+ ? theme.colors.textNormal
78
+ : theme.colors.disabled
79
+ }
80
+ weight={type.value === typeSelected ? 'bold' : 'normal'}>
81
+ {type.name}
82
+ </OText>
83
+ </OTab>
84
+ </TabBtn>
85
+ ))}
86
+ </OTabs>
87
+ </View>
88
+ ) : (
89
+ <>
90
+ <NavBar
91
+ onActionLeft={() => goToBack()}
92
+ btnStyle={{ paddingLeft: 0 }}
93
+ paddingTop={0}
94
+ style={{ paddingBottom: 0 }}
95
+ title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
96
+ titleAlign={'center'}
97
+ titleStyle={{ fontSize: 14 }}
98
+ />
99
+ {
100
+ items.length > 0 && (
101
+ <ListWrapper>
102
+ {
103
+ items && items.map((item: any, idx: number) =>
104
+ <OrderTypeWrapper activeOpacity={0.8} key={idx} disabled={orderState.loading} onPress={() => handleChangeOrderTypeCallback(item.value)}>
105
+ <BgImage source={theme.images.orderTypes[`type${item?.value || 1}`]} resizeMode={'cover'} style={{ opacity: item?.value == typeSelected || typeSelected === undefined ? 1 : 0.4 }}>
106
+ <MaskCont>
107
+ <OText size={12} lineHeight={18} color={theme.colors.white} weight={Platform.OS === 'android' ? 'bold' : '600'}>{item?.label}</OText>
108
+ <OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
109
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
110
+ <OText size={10} lineHeight={15} color={theme.colors.white}>{t('START_MY_ORDER', 'Start my order')}</OText>
111
+ <OIcon src={theme.images.general.arrow_left} width={16} color={theme.colors.white} style={{ transform: [{ rotate: '180deg' }], marginStart: 4 }} />
112
+ </View>
113
+ </MaskCont>
114
+ </BgImage>
115
+ </OrderTypeWrapper>
116
+ )
117
+ }
118
+ </ListWrapper>
119
+ )
120
+ }
121
+ </>
122
+ )}
123
+
82
124
  </Wrapper>
83
125
  )
84
126
  }
@@ -24,4 +24,22 @@ export const MaskCont = styled.View`
24
24
  padding: 16px 39px;
25
25
  background-color: #0000004D;
26
26
  height: 100%;
27
- `;
27
+ `;
28
+
29
+ export const OTabs = styled.View`
30
+ flex-direction: row;
31
+ width: 100%;
32
+ margin-bottom: -1px;
33
+ justify-content: space-between;
34
+ `;
35
+
36
+ export const OTab = styled.View`
37
+ padding-bottom: 10px;
38
+ border-bottom-width: 1px;
39
+ padding-horizontal: 10px;
40
+ `;
41
+
42
+ export const TabBtn = styled.TouchableOpacity`
43
+ min-height: 30px;
44
+ height: 30px;
45
+ `;