ordering-ui-react-native 0.16.63 → 0.16.66

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.63",
3
+ "version": "0.16.66",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -46,7 +46,7 @@ export const BusinessBasicInformation = (
46
46
  const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
47
47
  const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
48
48
  const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
49
- const isChewLayout = theme?.layouts?.business_view?.components?.header?.components?.layout?.type === 'chew'
49
+ const isChewLayout = orderingTheme?.theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
50
50
  const showLogo = !orderingTheme?.theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
51
51
 
52
52
  const styles = StyleSheet.create({
@@ -129,7 +129,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
129
129
  onProductClick={() => onProductClick(product)}
130
130
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
131
131
  handleUpdateProducts={handleUpdateProducts}
132
- navigation={navigation}
132
+ navigation={navigation}
133
133
  />
134
134
  ))
135
135
  }
@@ -75,9 +75,9 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
75
75
  const [{ configs }] = useConfig()
76
76
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
77
77
 
78
- const isChewLayout = theme?.layouts?.business_view?.components?.header?.components?.layout?.type === 'chew'
78
+ const isChewLayout = orderingTheme?.theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
79
79
  const showLogo = !orderingTheme?.theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
80
- const showBusinessNearCity = !theme?.layouts?.business_view?.components?.near_business?.hidden
80
+ const hideBusinessNearCity = orderingTheme?.theme?.business_view?.components?.near_business?.hidden
81
81
 
82
82
  const styles = StyleSheet.create({
83
83
  mainContainer: {
@@ -277,7 +277,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
277
277
  </WrapSearchBar>
278
278
  )}
279
279
  </TopHeader>
280
- {showBusinessNearCity && businessState?.business?.city_id && (
280
+ {!hideBusinessNearCity && businessState?.business?.city_id && (
281
281
  <NearBusiness>
282
282
  <BusinessesListing
283
283
  logosLayout
@@ -80,8 +80,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
80
80
  const appState = useRef(AppState.currentState)
81
81
  const searchBarRef = useRef<any>()
82
82
  const [appStateVisible, setAppStateVisible] = useState(appState.current);
83
- const isChewLayout = theme?.layouts?.header?.components?.layout?.type === 'chew'
84
- const showCities = !orderingTheme?.theme?.business_listing_view?.components?.cities?.hidden
83
+ const isChewLayout = orderingTheme?.theme?.header?.components?.layout?.type === 'chew'
84
+ const hideCities = orderingTheme?.theme?.business_listing_view?.components?.cities?.hidden
85
85
  const [refreshing] = useState(false);
86
86
  const styles = StyleSheet.create({
87
87
  container: {
@@ -216,7 +216,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
216
216
  }
217
217
  }
218
218
 
219
- const handleChangeCity = (cityId : number | null) => {
219
+ const handleChangeCity = (cityId: number | null) => {
220
220
  changeCityFilter(orderState?.options?.city_id === cityId ? null : cityId)
221
221
  setIsOpenCities(false)
222
222
  }
@@ -485,7 +485,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
485
485
  />
486
486
  )}
487
487
 
488
- {showCities && (
488
+ {!hideCities && (
489
489
  <View style={{ marginTop: 10 }}>
490
490
  <OButton
491
491
  onClick={() => setIsOpenCities(true)}
@@ -1,6 +1,6 @@
1
1
 
2
2
  import React, { useState, useEffect } from 'react'
3
- import { useOrder, useSession, useLanguage } from 'ordering-components/native';
3
+ import { useOrder, useSession, useLanguage, useOrderingTheme } from 'ordering-components/native';
4
4
 
5
5
  import { useTheme } from 'styled-components/native'
6
6
  import { BusinessesListing as OriginalBusinessListing } from './Layout/Original'
@@ -11,7 +11,8 @@ import { ReviewTrigger } from '../ReviewTrigger';
11
11
  export const BusinessesListing = (props: any) => {
12
12
  const { logosLayout } = props
13
13
  const theme = useTheme()
14
- const layout = theme?.layouts?.business_listing_view?.components?.layout?.type || 'original'
14
+ const [orderingTheme] = useOrderingTheme()
15
+ const layout = orderingTheme?.theme?.business_listing_view?.components?.layout?.type || 'original'
15
16
  const [, t] = useLanguage();
16
17
  const [{ auth }] = useSession()
17
18
  const [, { getLastOrderHasNoReview }] = useOrder();
@@ -96,4 +97,4 @@ export const BusinessesListing = (props: any) => {
96
97
  )}
97
98
  </>
98
99
  )
99
- }
100
+ }
@@ -8,7 +8,7 @@ import {
8
8
  useValidationFields,
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
- import { CContainer, CheckoutAction, Divider } from './styles';
11
+ import { CContainer, CheckoutAction, Divider, DriverTipsContainer } from './styles';
12
12
 
13
13
  import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
14
14
 
@@ -25,6 +25,7 @@ import { TaxInformation } from '../TaxInformation';
25
25
  import { CartStoresListing } from '../CartStoresListing';
26
26
  import { OAlert } from '../../../../../src/components/shared'
27
27
  import { PlaceSpot } from '../PlaceSpot'
28
+ import { DriverTips } from '../DriverTips'
28
29
 
29
30
  const CartUI = (props: any) => {
30
31
  const {
@@ -66,6 +67,10 @@ const CartUI = (props: any) => {
66
67
  const businessId = business?.business_id ?? null
67
68
  const placeSpotTypes = [4]
68
69
 
70
+ const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
71
+ ? JSON.parse(configs?.driver_tip_options?.value) || []
72
+ : configs?.driver_tip_options?.value || []
73
+
69
74
  const momentFormatted = !orderState?.option?.moment
70
75
  ? t('RIGHT_NOW', 'Right Now')
71
76
  : parseDate(orderState?.option?.moment, { outputFormat: 'YYYY-MM-DD HH:mm' })
@@ -355,6 +360,32 @@ const CartUI = (props: any) => {
355
360
  </OSTable>
356
361
  )}
357
362
 
363
+ {isMultiCheckout &&
364
+ cart &&
365
+ cart?.valid &&
366
+ orderState?.options?.type === 1 &&
367
+ cart?.status !== 2 &&
368
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
369
+ driverTipsOptions && driverTipsOptions?.length > 0 &&
370
+ (
371
+ <DriverTipsContainer>
372
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
373
+ {t('DRIVER_TIPS', 'Driver Tips')}
374
+ </OText>
375
+ <DriverTips
376
+ uuid={cart?.uuid}
377
+ businessId={cart?.business_id}
378
+ driverTipsOptions={driverTipsOptions}
379
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
380
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
381
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
382
+ ? cart?.driver_tip
383
+ : cart?.driver_tip_rate}
384
+ useOrderContext
385
+ />
386
+ </DriverTipsContainer>
387
+ )}
388
+
358
389
  <OSTotal>
359
390
  <OSTable style={{ marginTop: 15 }}>
360
391
  <OText size={14} lineHeight={21} weight={'600'}>
@@ -33,3 +33,7 @@ export const Divider = styled.View`
33
33
  margin-top: 5px;
34
34
  margin-bottom: 10px;
35
35
  `
36
+
37
+ export const DriverTipsContainer = styled.View`
38
+ padding: 5px 0;
39
+ `
@@ -1093,6 +1093,7 @@ export const ProductOptionsUI = (props: any) => {
1093
1093
  export const ProductForm = (props: any) => {
1094
1094
  const productOptionsProps = {
1095
1095
  ...props,
1096
+ productCart: { quantity: props?.product?.minimum_per_order || 1 },
1096
1097
  UIComponent: ProductOptionsUI,
1097
1098
  };
1098
1099
 
@@ -5,6 +5,7 @@ import {
5
5
  useOrder,
6
6
  useUtils,
7
7
  useSession,
8
+ useOrderingTheme,
8
9
  SingleProductCard as SingleProductCardController
9
10
  } from 'ordering-components/native';
10
11
  import { useTheme } from 'styled-components/native';
@@ -39,7 +40,8 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
39
40
  } = props;
40
41
 
41
42
  const theme = useTheme();
42
- const showAddButton = !theme?.layouts?.business_view?.components?.products?.components?.add_to_cart_button?.hidden
43
+ const [orderingTheme] = useOrderingTheme()
44
+ const hideAddButton = orderingTheme?.theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden
43
45
 
44
46
  const styles = StyleSheet.create({
45
47
  container: {
@@ -132,7 +134,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
132
134
  <InView style={{ minHeight: 200 }} triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(true)}>
133
135
  {isIntersectionObserver ? (
134
136
  <CardContainer
135
- showAddButton={showAddButton}
137
+ showAddButton={!hideAddButton}
136
138
  style={[
137
139
  styles.container,
138
140
  (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
@@ -202,7 +204,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
202
204
  </OText>
203
205
  </RibbonBox>
204
206
  )}
205
- {product?.images ? (
207
+ {product?.images && (
206
208
  <FastImage
207
209
  style={styles.productStyle}
208
210
  source={{
@@ -211,15 +213,6 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
211
213
  }}
212
214
  resizeMode={FastImage.resizeMode.cover}
213
215
  />
214
- ) : (
215
- <FastImage
216
- style={styles.productStyle}
217
- source={{
218
- uri: Image.resolveAssetSource(theme.images.dummies.product).uri,
219
- priority: FastImage.priority.normal,
220
- }}
221
- resizeMode={FastImage.resizeMode.cover}
222
- />
223
216
  )}
224
217
  </LogoWrapper>
225
218
 
@@ -231,7 +224,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
231
224
  </SoldOut>
232
225
  )}
233
226
  </View>
234
- {showAddButton && (
227
+ {!hideAddButton && (
235
228
  <OButton
236
229
  onClick={() => onProductClick?.(product)}
237
230
  style={{