ordering-ui-react-native 0.17.59-release → 0.17.60-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 (22) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +5 -5
  3. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +46 -20
  4. package/themes/original/src/components/BusinessInformation/index.tsx +34 -3
  5. package/themes/original/src/components/BusinessProductsListing/index.tsx +4 -3
  6. package/themes/original/src/components/Checkout/index.tsx +33 -4
  7. package/themes/original/src/components/GoogleMap/index.tsx +46 -2
  8. package/themes/original/src/components/LoginForm/index.tsx +0 -1
  9. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +10 -3
  10. package/themes/original/src/components/MyOrders/index.tsx +12 -0
  11. package/themes/original/src/components/NavBar/index.tsx +3 -0
  12. package/themes/original/src/components/OrderSummary/index.tsx +4 -3
  13. package/themes/original/src/components/PaymentOptions/index.tsx +12 -28
  14. package/themes/original/src/components/ProductForm/index.tsx +1 -1
  15. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  16. package/themes/original/src/components/ProductOptionSubOption/index.tsx +11 -11
  17. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  18. package/themes/original/src/components/SignupForm/index.tsx +1 -1
  19. package/themes/original/src/components/StripeCardsList/index.tsx +39 -5
  20. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  21. package/themes/original/src/components/Wallets/index.tsx +2 -2
  22. package/themes/original/src/types/index.tsx +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.59-release",
3
+ "version": "0.17.60-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -215,7 +215,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
215
215
  status: 7,
216
216
  },
217
217
  rejectByBusiness: {
218
- comment: comments,
218
+ reasons: comments,
219
219
  status: 5,
220
220
  },
221
221
  acceptByDriver: {
@@ -223,22 +223,22 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
223
223
  status: 8,
224
224
  },
225
225
  rejectByDriver: {
226
- comment: comments,
226
+ reasons: comments,
227
227
  status: 6,
228
228
  reject_reason: rejectReason
229
229
  },
230
230
  pickupFailedByDriver: {
231
- comment: comments,
231
+ reasons: comments,
232
232
  status: 10,
233
233
  reject_reason: rejectReason
234
234
  },
235
235
  deliveryFailedByDriver: {
236
- comment: comments,
236
+ reasons: comments,
237
237
  status: 12,
238
238
  reject_reason: rejectReason
239
239
  },
240
240
  orderNotReady: {
241
- comment: comments,
241
+ reasons: comments,
242
242
  status: 14,
243
243
  reject_reason: rejectReason
244
244
  },
@@ -54,8 +54,14 @@ export const OrderContentComponent = (props: OrderContent) => {
54
54
 
55
55
  const [openReviewModal, setOpenReviewModal] = useState(false)
56
56
 
57
- const [isReadMore, setIsReadMore] = useState(false)
58
- const [lengthMore, setLengthMore] = useState(false)
57
+ const [isReadMore, setIsReadMore] = useState({
58
+ customerAddress: false,
59
+ businessAddressNotes: false
60
+ })
61
+ const [lengthMore, setLengthMore] = useState({
62
+ customerAddress: false,
63
+ businessAddressNotes: false
64
+ })
59
65
 
60
66
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
61
67
 
@@ -108,8 +114,15 @@ export const OrderContentComponent = (props: OrderContent) => {
108
114
  return /^\d+$/.test(str);
109
115
  }
110
116
 
111
- const onTextLayout = useCallback((e: any) => {
112
- setLengthMore((e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2); //to check the text is more than 2 lines or not
117
+ const onTextLayout = useCallback((e: any, item: string) => {
118
+ if (item === 'customerAddress') {
119
+ const customerAddressMore = (e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2
120
+ setLengthMore(prev => ({ ...prev, customerAddress: customerAddressMore }))
121
+ }
122
+ if (item === 'businessAddressNotes') {
123
+ const businessAddressNotesMore = (e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3
124
+ setLengthMore(prev => ({ ...prev, businessAddressNotes: businessAddressNotesMore }))
125
+ }
113
126
  }, []);
114
127
 
115
128
  return (
@@ -209,17 +222,28 @@ export const OrderContentComponent = (props: OrderContent) => {
209
222
  </OText>
210
223
  )}
211
224
  {!!order?.business?.address_notes && (
212
- <View style={styles.linkWithIcons}>
213
- <OLink
214
- PressStyle={styles.linkWithIcons}
215
- url={Platform.select({
216
- ios: `maps:0,0?q=${order?.business?.address_notes}`,
217
- android: `geo:0,0?q=${order?.business?.address_notes}`,
218
- })}
219
- shorcut={order?.business?.address_notes}
220
- TextStyle={styles.textLink}
221
- />
222
- </View>
225
+ <>
226
+ <View style={styles.linkWithIcons}>
227
+ <OLink
228
+ PressStyle={styles.linkWithIcons}
229
+ url={Platform.select({
230
+ ios: `maps:0,0?q=${order?.business?.address_notes}`,
231
+ android: `geo:0,0?q=${order?.business?.address_notes}`,
232
+ })}
233
+ shorcut={order?.business?.address_notes}
234
+ TextStyle={styles.textLink}
235
+ onTextLayout={e => onTextLayout(e, 'businessAddressNotes')}
236
+ numberOfLines={isReadMore.businessAddressNotes ? 20 : 3}
237
+ />
238
+ </View>
239
+ {lengthMore.businessAddressNotes && (
240
+ <TouchableOpacity
241
+ onPress={() => setIsReadMore({ ...isReadMore, businessAddressNotes: !isReadMore.businessAddressNotes })}
242
+ >
243
+ <OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore.businessAddressNotes ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
244
+ </TouchableOpacity>
245
+ )}
246
+ </>
223
247
  )}
224
248
  </OrderBusiness>
225
249
 
@@ -327,15 +351,17 @@ export const OrderContentComponent = (props: OrderContent) => {
327
351
  ios: `maps:0,0?q=${order?.customer?.address}`,
328
352
  android: `geo:0,0?q=${order?.customer?.address}`,
329
353
  })}
330
- onTextLayout={onTextLayout}
331
- numberOfLines={isReadMore ? 20 : 2}
354
+ onTextLayout={e => onTextLayout(e, 'customerAddress')}
355
+ numberOfLines={isReadMore.customerAddress ? 20 : 2}
332
356
  shorcut={order?.customer?.address}
333
357
  TextStyle={styles.textLink}
334
358
  />
335
359
  </View>
336
- {lengthMore && (
337
- <TouchableOpacity onPress={() => setIsReadMore(!isReadMore)}>
338
- <OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
360
+ {lengthMore.customerAddress && (
361
+ <TouchableOpacity
362
+ onPress={() => setIsReadMore({ ...isReadMore, customerAddress: !isReadMore.customerAddress })}
363
+ >
364
+ <OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore.customerAddress ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
339
365
  </TouchableOpacity>
340
366
  )}
341
367
  </>
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState, useCallback } from 'react';
2
2
  import {
3
3
  BusinessInformation as BusinessInformationController,
4
4
  useLanguage, useUtils, useConfig,
@@ -16,13 +16,16 @@ import {
16
16
  DivideView,
17
17
  MediaWrapper,
18
18
  } from './styles';
19
- import { StyleSheet, View } from 'react-native';
19
+ import { StyleSheet, View, TouchableOpacity } from 'react-native';
20
20
  import { BusinessInformationParams } from '../../types';
21
21
  import { GoogleMap } from '../GoogleMap';
22
22
  import { WebView } from 'react-native-webview';
23
23
  import { formatUrlVideo } from '../../utils'
24
24
  import { ScheduleAccordion } from '../ScheduleAccordion';
25
25
  import moment from 'moment';
26
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
27
+ const { useDeviceOrientation } = DeviceOrientationMethods
28
+
26
29
  const BusinessInformationUI = (props: BusinessInformationParams) => {
27
30
  const { businessState, businessSchedule, businessLocation } = props;
28
31
 
@@ -30,6 +33,11 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
30
33
  const [, t] = useLanguage();
31
34
  const [{ optimizeImage }] = useUtils();
32
35
  const [{ configs }] = useConfig()
36
+ const [orientationState] = useDeviceOrientation();
37
+
38
+ const [isReadMore, setIsReadMore] = useState(false)
39
+ const [lengthMore, setLengthMore] = useState(false)
40
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
33
41
 
34
42
  const hideLocation = theme?.business_view?.components?.information?.components?.location?.hidden
35
43
  const hideSchedule = theme?.business_view?.components?.information?.components?.schedule?.hidden
@@ -73,6 +81,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
73
81
  return iAry;
74
82
  };
75
83
 
84
+ const onTextLayout = useCallback((e: any) => {
85
+ setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
86
+ }, [])
87
+
76
88
  return (
77
89
  <BusinessInformationContainer>
78
90
  <WrapMainContent contentContainerStyle={{}}>
@@ -99,10 +111,29 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
99
111
  </>
100
112
  )}
101
113
  {!hideAddress && (
102
- <OText size={12} mBottom={20}>
114
+ <OText size={12} mBottom={10}>
103
115
  {businessState?.business?.address}
104
116
  </OText>
105
117
  )}
118
+ {businessState?.business?.address_notes && (
119
+ <>
120
+ <OText
121
+ size={12}
122
+ mBottom={10}
123
+ numberOfLines={isReadMore ? 20 : 3}
124
+ onTextLayout={onTextLayout}
125
+ >
126
+ {businessState?.business?.address_notes}
127
+ </OText>
128
+ {lengthMore && (
129
+ <TouchableOpacity
130
+ onPress={() => setIsReadMore(!isReadMore)}
131
+ >
132
+ <OText size={12} mBottom={20} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
133
+ </TouchableOpacity>
134
+ )}
135
+ </>
136
+ )}
106
137
  <DivideView />
107
138
  {!hideSchedule && (
108
139
  <>
@@ -45,7 +45,6 @@ import { ProfessionalFilter } from '../ProfessionalFilter';
45
45
  import { ServiceForm } from '../ServiceForm';
46
46
  import { BusinessesListing } from '../BusinessesListing/Layout/Original'
47
47
  import { PageBanner } from '../PageBanner'
48
- import { vibrateApp } from '../../utils';
49
48
 
50
49
  const PIXELS_TO_SCROLL = 2000
51
50
 
@@ -164,9 +163,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
164
163
  if (product.ingredients?.length === 0 && product.extras.length === 0 && !product.inventoried && auth && isQuickAddProduct) {
165
164
  const isProductAddedToCart = currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)
166
165
  const productQuantity = isProductAddedToCart?.quantity
166
+ const minimumPerOrder = product?.minimum_per_order || 1
167
167
  const addCurrentProduct = {
168
168
  ...product,
169
- quantity: 1
169
+ quantity: minimumPerOrder
170
170
  }
171
171
  const updateCurrentProduct = {
172
172
  name: product?.name,
@@ -285,7 +285,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
285
285
  }, []);
286
286
 
287
287
  const handleBackNavigation = () => {
288
- navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
288
+ navigation?.canGoBack() && !props.fromMulti ? navigation.goBack() : navigation.navigate('BottomTab')
289
289
  }
290
290
 
291
291
  const adjustBusiness = async (adjustBusinessId: number) => {
@@ -323,6 +323,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
323
323
  }
324
324
  }, [isFocused])
325
325
 
326
+
326
327
  useEffect(() => {
327
328
  function onKeyboardDidShow(e: KeyboardEvent) {
328
329
  setKeyboardHeight(e?.endCoordinates?.height);
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useState, useEffect, useCallback } from 'react';
2
2
  import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView } from 'react-native';
3
3
  import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
4
  import Picker from 'react-native-country-picker-modal';
@@ -53,9 +53,11 @@ import { FloatingButton } from '../FloatingButton';
53
53
  import { Container } from '../../layouts/Container';
54
54
  import NavBar from '../NavBar';
55
55
  import { OrderSummary } from '../OrderSummary';
56
- import { getTypesText, vibrateApp } from '../../utils';
56
+ import { getTypesText } from '../../utils';
57
57
  import { CartStoresListing } from '../CartStoresListing';
58
58
  import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
59
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
60
+ const { useDeviceOrientation } = DeviceOrientationMethods
59
61
 
60
62
  const mapConfigs = {
61
63
  mapZoom: 16,
@@ -141,6 +143,10 @@ const CheckoutUI = (props: any) => {
141
143
  const [{ options, carts, loading }, { confirmCart }] = useOrder();
142
144
  const [validationFields] = useValidationFields();
143
145
  const [events] = useEvent()
146
+ const [orientationState] = useDeviceOrientation();
147
+ const [isReadMore, setIsReadMore] = useState(false)
148
+ const [lengthMore, setLengthMore] = useState(false)
149
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
144
150
 
145
151
  const [errorCash, setErrorCash] = useState(false);
146
152
  const [userErrors, setUserErrors] = useState<any>([]);
@@ -279,7 +285,7 @@ const CheckoutUI = (props: any) => {
279
285
  const checkValidationFields = () => {
280
286
  setUserErrors([])
281
287
  const errors = []
282
- const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
288
+ const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
283
289
  const _requiredFields: any = []
284
290
 
285
291
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
@@ -327,7 +333,7 @@ const CheckoutUI = (props: any) => {
327
333
  useEffect(() => {
328
334
  if (cart?.products?.length === 0) {
329
335
  if (cart?.business?.slug) {
330
- onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
336
+ onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
331
337
  } else {
332
338
  onNavigationRedirect('Wallets')
333
339
  }
@@ -367,6 +373,10 @@ const CheckoutUI = (props: any) => {
367
373
  }
368
374
  }, [cart?.paymethod_data])
369
375
 
376
+ const onTextLayout = useCallback((e: any) => {
377
+ setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
378
+ }, [])
379
+
370
380
  return (
371
381
  <>
372
382
  <Container noPadding>
@@ -458,6 +468,25 @@ const CheckoutUI = (props: any) => {
458
468
  {businessDetails?.business?.address}
459
469
  </OText>
460
470
  )}
471
+ {businessDetails?.business?.address_notes && (
472
+ <>
473
+ <OText
474
+ size={12}
475
+ lineHeight={18}
476
+ numberOfLines={isReadMore ? 20 : 3}
477
+ onTextLayout={onTextLayout}
478
+ >
479
+ {businessDetails?.business?.address_notes}
480
+ </OText>
481
+ {lengthMore && (
482
+ <TouchableOpacity
483
+ onPress={() => setIsReadMore(!isReadMore)}
484
+ >
485
+ <OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
486
+ </TouchableOpacity>
487
+ )}
488
+ </>
489
+ )}
461
490
  </View>
462
491
  </>
463
492
  )}
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect, useRef } from 'react'
2
2
  import { Dimensions, StyleSheet, View, Platform } from 'react-native';
3
- import MapView, { PROVIDER_DEFAULT, PROVIDER_GOOGLE, Marker, Region, } from 'react-native-maps'
3
+ import MapView, { PROVIDER_DEFAULT, PROVIDER_GOOGLE, Marker, Region, Polygon, Circle } from 'react-native-maps'
4
4
  import Geocoder from 'react-native-geocoding';
5
5
  import { useLanguage, useConfig } from 'ordering-components/native'
6
6
  import { GoogleMapsParams } from '../../types';
@@ -19,7 +19,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
19
19
  setSaveLocation,
20
20
  handleToggleMap,
21
21
  locations,
22
- isIntGeoCoder
22
+ isIntGeoCoder,
23
+ businessZones
23
24
  } = props
24
25
 
25
26
  const [, t] = useLanguage()
@@ -44,6 +45,19 @@ export const GoogleMap = (props: GoogleMapsParams) => {
44
45
  ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
45
46
  }
46
47
 
48
+ const units: any = {
49
+ mi: 1609,
50
+ km: 1000
51
+ }
52
+
53
+ const types: any = [1, 2, 5]
54
+
55
+ const fillStyles = {
56
+ fillColor: 'rgba(44, 123, 229, 0.3)',
57
+ strokeColor: 'rgba(44, 123, 229, 1)',
58
+ strokeWidth: 2
59
+ }
60
+
47
61
  const geocodePosition = (pos: { latitude: number, longitude: number }, isMovingRegion ?: boolean) => {
48
62
  Geocoder.from({
49
63
  latitude: pos.latitude,
@@ -230,6 +244,36 @@ export const GoogleMap = (props: GoogleMapsParams) => {
230
244
  title={markerTitle || t('YOUR_LOCATION', 'Your Location')}
231
245
  />
232
246
  )}
247
+ {businessZones?.length > 0 && businessZones.filter((item: any) => types.includes(item?.type)).map((businessZone: any, i: number) => (
248
+ <React.Fragment key={i}>
249
+ {businessZone?.type === 2 && Array.isArray(businessZone?.data) && (
250
+ <Polygon
251
+ coordinates={businessZone?.data.map((item: any) => ({ latitude: item.lat, longitude: item.lng}))}
252
+ fillColor={fillStyles.fillColor}
253
+ strokeColor={fillStyles.strokeColor}
254
+ strokeWidth={fillStyles.strokeWidth}
255
+ />
256
+ )}
257
+ {(businessZone.type === 1 && businessZone?.data?.center && businessZone?.data?.radio) && (
258
+ <Circle
259
+ center={{ latitude: businessZone?.data?.center.lat, longitude: businessZone?.data?.center.lng}}
260
+ radius={businessZone?.data.radio * 1000}
261
+ fillColor={fillStyles.fillColor}
262
+ strokeColor={fillStyles.strokeColor}
263
+ strokeWidth={fillStyles.strokeWidth}
264
+ />
265
+ )}
266
+ {(businessZone.type === 5 && businessZone?.data?.distance) && (
267
+ <Circle
268
+ center={{ latitude: businessZone?.data?.center.lat, longitude: businessZone?.data?.center.lng}}
269
+ radius={businessZone?.data.distance * units[businessZone?.data?.unit]}
270
+ fillColor={fillStyles.fillColor}
271
+ strokeColor={fillStyles.strokeColor}
272
+ strokeWidth={fillStyles.strokeWidth}
273
+ />
274
+ )}
275
+ </React.Fragment>
276
+ ))}
233
277
  </MapView>
234
278
  <Alert
235
279
  open={alertState.open}
@@ -46,7 +46,6 @@ import { AppleLogin } from '../AppleLogin';
46
46
  import { Otp } from './Otp'
47
47
  import { TouchableOpacity } from 'react-native-gesture-handler';
48
48
  import Alert from '../../../../../src/providers/AlertProvider'
49
- import { vibrateApp } from '../../utils';
50
49
 
51
50
  const LoginFormUI = (props: LoginParams) => {
52
51
  const {
@@ -47,7 +47,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
47
47
  const [, t] = useLanguage()
48
48
  const [{ configs }] = useConfig()
49
49
  const [{ parsePrice }] = useUtils()
50
- const [, { showToast }] = useToast();
50
+ const [, { showToast }] = useToast();
51
51
  const { confirmApplePayPayment } = useApplePay()
52
52
 
53
53
  const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
@@ -216,6 +216,13 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
216
216
  publicKey={paymethodSelected?.data?.publishable}
217
217
  payType={paymethodSelected?.paymethod?.name}
218
218
  onSelectCard={handlePaymethodDataChange}
219
+ addCardOpen={addCardOpen}
220
+ setAddCardOpen={setAddCardOpen}
221
+ openCarts={openCarts}
222
+ toSave
223
+ handlePaymethodDataChange={handlePaymethodDataChange}
224
+ clientSecret={props.clientSecret}
225
+ onPaymentChange={handlePaymethodDataChange}
219
226
  />
220
227
  </View>
221
228
  )}
@@ -299,7 +306,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
299
306
  </>
300
307
  )}
301
308
 
302
- <OModal
309
+ {/* <OModal
303
310
  entireModal
304
311
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
305
312
  open={addCardOpen.stripe}
@@ -322,7 +329,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
322
329
  onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
323
330
  />
324
331
  </KeyboardAvoidingView>
325
- </OModal>
332
+ </OModal> */}
326
333
  </PMContainer>
327
334
  )
328
335
  }
@@ -148,6 +148,18 @@ export const MyOrders = (props: any) => {
148
148
  )}
149
149
  {selectedOption === 'orders' && (
150
150
  <>
151
+ {ordersLength?.preordersLength > 0 && (
152
+ <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
153
+ <OrdersOption
154
+ {...props}
155
+ preOrders
156
+ ordersLength={ordersLength}
157
+ setOrdersLength={setOrdersLength}
158
+ setRefreshOrders={setRefreshOrders}
159
+ refreshOrders={refreshOrders}
160
+ />
161
+ </View>
162
+ )}
151
163
  <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
152
164
  <OrdersOption
153
165
  {...props}
@@ -1,3 +1,6 @@
1
+
2
+
3
+
1
4
  import * as React from 'react'
2
5
  import styled, { useTheme } from 'styled-components/native'
3
6
  import { OButton, OIcon, OText } from '../shared'
@@ -58,6 +58,7 @@ const OrderSummaryUI = (props: any) => {
58
58
  const [validationFields] = useValidationFields();
59
59
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
60
60
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
61
+ const hideCartComments = !validationFields?.fields?.checkout?.comments?.enabled
61
62
 
62
63
  const cart = orderState?.carts?.[`businessId:${props.cart.business_id}`]
63
64
 
@@ -208,8 +209,8 @@ const OrderSummaryUI = (props: any) => {
208
209
  ))
209
210
  }
210
211
  {
211
- cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
212
- <OSTable key={fee?.id}>
212
+ cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any, i: number) => (
213
+ <OSTable key={fee?.id + i}>
213
214
  <OSRow>
214
215
  <OText size={12} numberOfLines={1}>
215
216
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
@@ -322,7 +323,7 @@ const OrderSummaryUI = (props: any) => {
322
323
  )}
323
324
  </View>
324
325
  )}
325
- {cart?.business_id && cart?.status !== 2 && (
326
+ {cart?.business_id && cart?.status !== 2 && !hideCartComments && (
326
327
  <OSTable>
327
328
  <View style={{ width: '100%', marginTop: 20 }}>
328
329
  <OText size={12}>{t('COMMENTS', 'Comments')}</OText>
@@ -264,7 +264,7 @@ const PaymentOptionsUI = (props: any) => {
264
264
  />
265
265
  )}
266
266
 
267
- {stripeOptions.includes(paymethodSelected?.gateway) &&
267
+ {/* {stripeOptions.includes(paymethodSelected?.gateway) &&
268
268
  (paymethodData?.brand || paymethodData?.card?.brand) &&
269
269
  (paymethodData?.last4 || paymethodData?.card?.last4) &&
270
270
  (
@@ -293,10 +293,10 @@ const PaymentOptionsUI = (props: any) => {
293
293
  </View>
294
294
  </PMCardItemContent>
295
295
  </PMCardSelected>
296
- )}
296
+ )} */}
297
297
 
298
298
  {/* Stripe */}
299
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
299
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && (
300
300
  <View>
301
301
  <OButton
302
302
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -314,8 +314,15 @@ const PaymentOptionsUI = (props: any) => {
314
314
  payType={paymethodsList?.name}
315
315
  onSelectCard={handlePaymethodDataChange}
316
316
  onNavigationRedirect={onNavigationRedirect}
317
+ paymethodCardId={paymethodData?.id}
317
318
  onCancel={() => handlePaymethodClick(null)}
318
- setAddCardOpen={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
319
+ setAddCardOpen={setAddCardOpen}
320
+ addCardOpen={addCardOpen}
321
+ isOpenMethod={isOpenMethod}
322
+ handlePaymethodDataChange={handlePaymethodDataChange}
323
+ clientSecret={props.clientSecret}
324
+ businessId={props.businessId}
325
+ onPaymentChange={onPaymentChange}
319
326
  />
320
327
  </View>
321
328
  )}
@@ -355,29 +362,6 @@ const PaymentOptionsUI = (props: any) => {
355
362
  />
356
363
  )}
357
364
 
358
- <OModal
359
- entireModal
360
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
361
- open={addCardOpen.stripe}
362
- onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
363
- style={{ backgroundColor: 'red' }}
364
- >
365
- <KeyboardAvoidingView
366
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
367
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
368
- enabled={Platform.OS === 'ios' ? true : false}
369
- >
370
- <StripeElementsForm
371
- toSave
372
- businessId={props.businessId}
373
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
374
- requirements={props.clientSecret}
375
- onSelectCard={handlePaymethodDataChange}
376
- onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
377
- />
378
- </KeyboardAvoidingView>
379
- </OModal>
380
-
381
365
  {/* Stripe direct */}
382
366
  <OModal
383
367
  entireModal
@@ -426,7 +410,7 @@ const PaymentOptionsUI = (props: any) => {
426
410
  />
427
411
  </View>
428
412
  )}
429
-
413
+ {/** Stripe connect add cards */}
430
414
  <OModal
431
415
  entireModal
432
416
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
@@ -55,7 +55,7 @@ import { ProductOptionSubOption } from '../ProductOptionSubOption';
55
55
  import { NotFoundSource } from '../NotFoundSource';
56
56
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
57
57
  import NavBar from '../NavBar';
58
- import { orderTypeList } from '../../utils';
58
+ import { orderTypeList, vibrateApp } from '../../utils';
59
59
  const windowWidth = Dimensions.get('window').width;
60
60
 
61
61
  export const ProductOptionsUI = (props: any) => {
@@ -70,7 +70,7 @@ export const ProductActions = styled.View`
70
70
  position: absolute;
71
71
  bottom: 0px;
72
72
  padding-top: ${(props: any) => props.ios ? '20px' : '0'};
73
- padding-horizontal: 40px;
73
+ padding-horizontal: 30px;
74
74
  padding-vertical: 20px;
75
75
  width: 100%;
76
76
  flex-direction: ${(props: any) => props.isColumn ? 'column' : 'row'};
@@ -82,12 +82,12 @@ export const ProductOptionSubOptionUI = (props: any) => {
82
82
  <OIcon src={theme.images.general.radio_nor} color={theme.colors.disabled} width={16} />
83
83
  )
84
84
  )}
85
- <OText size={12} lineHeight={18} color={theme.colors.textSecondary} mLeft={10} style={{ flex: 1 }}>
85
+ <OText size={12} lineHeight={18} color={theme.colors.textSecondary} mLeft={5} style={{ flex: 1 }}>
86
86
  {suboption?.name}
87
87
  </OText>
88
88
  </IconControl>
89
- <QuantityControl>
90
- {option?.allow_suboption_quantity && state?.selected && (
89
+ {option?.allow_suboption_quantity && state?.selected && (
90
+ <QuantityControl>
91
91
  <>
92
92
  <Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
93
93
  <IconAntDesign
@@ -96,7 +96,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
96
96
  color={state.quantity === 0 || disabled ? theme.colors.disabled : theme.colors.primary}
97
97
  />
98
98
  </Checkbox>
99
- <OText size={12} mLeft={5} mRight={5}>
99
+ <OText size={12}>
100
100
  {state.quantity}
101
101
  </OText>
102
102
  <Checkbox disabled={disabled || disableIncrement} onPress={increment}>
@@ -107,10 +107,10 @@ export const ProductOptionSubOptionUI = (props: any) => {
107
107
  />
108
108
  </Checkbox>
109
109
  </>
110
- )}
111
- </QuantityControl>
112
- <PositionControl>
113
- {option?.with_half_option && state?.selected && (
110
+ </QuantityControl>
111
+ )}
112
+ {option?.with_half_option && state?.selected && (
113
+ <PositionControl>
114
114
  <>
115
115
  <Circle disabled={disabled} onPress={() => changePosition('left')}>
116
116
  <OIcon
@@ -138,10 +138,10 @@ export const ProductOptionSubOptionUI = (props: any) => {
138
138
  />
139
139
  </Circle>
140
140
  </>
141
- )}
142
- </PositionControl>
141
+ </PositionControl>
142
+ )}
143
143
  {price > 0 && (
144
- <OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{ paddingRight: 10 }}>
144
+ <OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{width: 70, maxWidth: 70}}>
145
145
  + {parsePrice(price)}
146
146
  </OText>
147
147
  )}
@@ -9,30 +9,26 @@ export const Container = styled.TouchableOpacity`
9
9
 
10
10
  export const IconControl = styled.TouchableOpacity`
11
11
  flex-direction: row;
12
- padding: 10px;
13
- width: 38%;
12
+ padding: 10px 0 10px 10px;
13
+ width: 35%;
14
14
  align-items: center;
15
15
  `
16
16
 
17
17
  export const QuantityControl = styled.View`
18
18
  flex-direction: row;
19
19
  align-items: center;
20
- justify-content: flex-start;
21
- margin-right: 5px;
22
- flex: 1;
23
- width: 60px;
20
+ justify-content: space-between;
21
+ width: 62px;
24
22
  `
25
23
 
26
24
  export const PositionControl = styled.View`
27
25
  flex-direction: row;
28
26
  align-items: center;
29
- margin-right: 5px;
30
- flex: 1;
31
27
  `
32
28
 
33
29
  export const Checkbox = styled.TouchableOpacity`
34
30
  `
35
31
 
36
32
  export const Circle = styled.TouchableOpacity`
37
- margin: 0 1px;
33
+ margin: 0 1.5px;
38
34
  `
@@ -38,7 +38,7 @@ import Alert from '../../../../../src/providers/AlertProvider'
38
38
  import { OText, OButton, OInput } from '../shared';
39
39
  import { OModal } from '../../../../../src/components/shared';
40
40
  import { SignupParams } from '../../types';
41
- import { sortInputFields, vibrateApp } from '../../utils';
41
+ import { sortInputFields } from '../../utils';
42
42
  import { GoogleLogin } from '../GoogleLogin';
43
43
  import { AppleLogin } from '../AppleLogin';
44
44
 
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect } from 'react';
2
- import { View, StyleSheet, ScrollView } from 'react-native';
2
+ import { View, StyleSheet, ScrollView, Platform } from 'react-native';
3
3
  import {
4
4
  PaymentOptionStripe,
5
5
  useSession,
@@ -8,7 +8,7 @@ import {
8
8
  import { PlaceholderLine } from 'rn-placeholder';
9
9
  import { useTheme } from 'styled-components/native';
10
10
  import { getIconCard } from '../../utils';
11
- import { OAlert, OIcon, OText } from '../shared';
11
+ import { OAlert, OIcon, OText, OModal } from '../shared';
12
12
 
13
13
  import { NotFoundSource } from '../NotFoundSource';
14
14
 
@@ -17,6 +17,9 @@ import {
17
17
  OSItemContent,
18
18
  OSItemActions,
19
19
  } from '../PaymentOptionStripe/styles';
20
+ import { StripeElementsForm } from '../StripeElementsForm';
21
+
22
+ import { KeyboardAvoidingView } from 'react-native';
20
23
 
21
24
  export const StripeCardsListUI = (props: any) => {
22
25
  const {
@@ -26,7 +29,11 @@ export const StripeCardsListUI = (props: any) => {
26
29
  cardsList,
27
30
  handleCardClick,
28
31
  setAddCardOpen,
29
- gateway
32
+ gateway,
33
+ setCardsList,
34
+ addCardOpen,
35
+ isOpenMethod,
36
+ handlePaymethodDataChange
30
37
  } = props;
31
38
 
32
39
  const theme = useTheme();
@@ -42,8 +49,8 @@ export const StripeCardsListUI = (props: any) => {
42
49
  }
43
50
 
44
51
  useEffect(() => {
45
- if (!cardsList && !cardsList?.loading && cardsList?.cards?.length === 0 && !paymethodsWithoutSaveCards.includes(gateway)) {
46
- setAddCardOpen(true)
52
+ if (!cardsList?.loading && cardsList?.cards?.length === 0 && !paymethodsWithoutSaveCards.includes(gateway)) {
53
+ setAddCardOpen({ ...addCardOpen, stripe: true })
47
54
  }
48
55
  }, [cardsList?.loading])
49
56
 
@@ -128,6 +135,33 @@ export const StripeCardsListUI = (props: any) => {
128
135
  ))}
129
136
  </ScrollView>
130
137
  )}
138
+ <OModal
139
+ entireModal
140
+ title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
141
+ open={addCardOpen.stripe}
142
+ onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
143
+ style={{ backgroundColor: 'red' }}
144
+ >
145
+ <KeyboardAvoidingView
146
+ behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
147
+ keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
148
+ enabled={Platform.OS === 'ios' ? true : false}
149
+ >
150
+ <StripeElementsForm
151
+ openCarts={props.openCarts}
152
+ toSave
153
+ businessId={props.businessId}
154
+ businessIds={props.businessIds}
155
+ publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
156
+ setCardsList={setCardsList}
157
+ cardsList={cardsList}
158
+ requirements={props.clientSecret}
159
+ handleCardClick={handleCardClick}
160
+ onSelectCard={handlePaymethodDataChange}
161
+ onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
162
+ />
163
+ </KeyboardAvoidingView>
164
+ </OModal>
131
165
  </>
132
166
  )
133
167
  }
@@ -4,7 +4,10 @@ import { useApi, useSession } from 'ordering-components/native';
4
4
  export const StripeElementsForm = (props: any) => {
5
5
  const {
6
6
  UIComponent,
7
- toSave
7
+ toSave,
8
+ setCardsList,
9
+ cardsList,
10
+ handleCardClick
8
11
  } = props;
9
12
 
10
13
  const [ordering] = useApi();
@@ -61,6 +64,14 @@ export const StripeElementsForm = (props: any) => {
61
64
  })
62
65
  const response = await result.json();
63
66
  isNewCard && props.onSelectCard && props.onSelectCard(response.result);
67
+ setCardsList && setCardsList({
68
+ ...cardsList,
69
+ cards: [
70
+ ...cardsList.cards,
71
+ response.result
72
+ ]
73
+ })
74
+ handleCardClick(response.result)
64
75
  setState({
65
76
  ...state,
66
77
  loadingAdd: false
@@ -72,7 +72,7 @@ const WalletsUI = (props: any) => {
72
72
 
73
73
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
74
74
  const [openHistory, setOpenHistory] = useState(false)
75
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
75
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
76
76
  const hideWalletsTheme = theme?.bar_menu?.components?.wallets?.hidden
77
77
 
78
78
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
@@ -241,7 +241,7 @@ const WalletsUI = (props: any) => {
241
241
  {currentWalletSelected?.type === 'cash' && (
242
242
  <>
243
243
  <View style={styles.dividerStyle} />
244
- <GiftCardUI navigation={navigation} />
244
+ <GiftCardUI navigation={navigation} />
245
245
  <View style={styles.dividerStyle} />
246
246
  </>
247
247
  )}
@@ -256,6 +256,7 @@ export interface BusinessProductsListingParams {
256
256
  onBusinessClick?: any;
257
257
  onNavigationRedirect?: any;
258
258
  businessSingleId?: number | string
259
+ fromMulti?: boolean
259
260
  }
260
261
  export interface BusinessBasicInformationParams {
261
262
  navigation?: any;