ordering-ui-react-native 0.15.5 → 0.15.6

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.15.5",
3
+ "version": "0.15.6",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -29,7 +29,7 @@ const types = ['food', 'laundry', 'alcohol', 'groceries'];
29
29
  export const BusinessBasicInformation = (
30
30
  props: BusinessBasicInformationParams,
31
31
  ) => {
32
- const { navigation, businessState, isBusinessInfoShow, logo, header } = props;
32
+ const { navigation, businessState, isBusinessInfoShow, logo, header, isPreOrder } = props;
33
33
  const { business, loading } = businessState;
34
34
 
35
35
  const theme = useTheme();
@@ -181,12 +181,16 @@ export const BusinessBasicInformation = (
181
181
  <WrapReviews>
182
182
  {!isBusinessInfoShow && (
183
183
  <>
184
- <TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
185
- <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
186
- {t('PRE_ORDER', 'Preorder')}
187
- </OText>
188
- </TouchableOpacity>
189
- <OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
184
+ { isPreOrder && (
185
+ <>
186
+ <TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
187
+ <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
188
+ {t('PRE_ORDER', 'Preorder')}
189
+ </OText>
190
+ </TouchableOpacity>
191
+ <OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
192
+ </>
193
+ )}
190
194
  <TouchableOpacity onPress={() => setOpenBusinessReviews(true)}>
191
195
  <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
192
196
  {t('REVIEWS', 'Reviews')}
@@ -262,4 +266,4 @@ const styles = StyleSheet.create({
262
266
  zIndex: 100,
263
267
  left: 40
264
268
  },
265
- });
269
+ });
@@ -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,
@@ -231,6 +233,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
231
233
  openBusinessInformation={openBusinessInformation}
232
234
  header={header}
233
235
  logo={logo}
236
+ isPreOrder={isPreOrder}
234
237
  />
235
238
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
236
239
  {!loading && business?.id && (
@@ -134,6 +134,7 @@ const CheckoutUI = (props: any) => {
134
134
 
135
135
 
136
136
  const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
137
+ const isPreOrder = configs?.preorder_status_enabled?.value === '1'
137
138
 
138
139
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
139
140
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -149,6 +150,12 @@ const CheckoutUI = (props: any) => {
149
150
  }
150
151
  })
151
152
 
153
+ const handleMomentClick = () => {
154
+ if (isPreOrder) {
155
+ navigation.navigate('MomentOption')
156
+ }
157
+ }
158
+
152
159
  const handlePlaceOrder = () => {
153
160
  if (!userErrors.length) {
154
161
  handlerClickPlaceOrder && handlerClickPlaceOrder()
@@ -260,19 +267,21 @@ const CheckoutUI = (props: any) => {
260
267
  />
261
268
  </CHMomentWrapper>
262
269
  <CHMomentWrapper
263
- onPress={() => navigation.navigate('MomentOption')}
264
- disabled={loading}
270
+ onPress={() => handleMomentClick()}
271
+ disabled={loading}
265
272
  >
266
273
  <OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
267
274
  {options?.moment
268
275
  ? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
269
276
  : t('ASAP_ABBREVIATION', 'ASAP')}
270
277
  </OText>
271
- <OIcon
272
- src={theme.images.general.arrow_down}
273
- width={10}
274
- style={{ marginStart: 8 }}
275
- />
278
+ { isPreOrder && (
279
+ <OIcon
280
+ src={theme.images.general.arrow_down}
281
+ width={10}
282
+ style={{ marginStart: 8 }}
283
+ />
284
+ )}
276
285
  </CHMomentWrapper>
277
286
  </ChHeader>
278
287
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
@@ -193,6 +193,7 @@ export interface BusinessBasicInformationParams {
193
193
  isBusinessInfoShow?: boolean;
194
194
  header?: any;
195
195
  logo?: any;
196
+ isPreOrder?: boolean;
196
197
  }
197
198
  export interface BusinessProductsCategoriesParams {
198
199
  categories: Array<any>;