ordering-ui-react-native 0.17.49-release → 0.17.50-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.49-release",
3
+ "version": "0.17.50-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -82,6 +82,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
82
82
 
83
83
  const validStatusComplete = [9, 19, 23]
84
84
 
85
+ const pendingOrderStatus = [1, 4, 7, 13]
86
+
85
87
  const logisticOrderStatus = [4, 6, 7]
86
88
 
87
89
  const showFloatButtonsPickUp: any = {
@@ -167,7 +169,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
167
169
  };
168
170
 
169
171
  const handleArrowBack: any = () => {
170
- if (alertState?.open && !isAllowedDriverRejectOrder) {
172
+ if (alertState?.open && !isAllowedDriverRejectOrder && !pendingOrderStatus.includes(order?.status)) {
171
173
  setAlertState({
172
174
  ...alertState,
173
175
  open: false
@@ -367,7 +369,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
367
369
  </View>
368
370
  )}
369
371
 
370
- {(!!props.order?.error || props.order?.error) && (
372
+ {(!!props.order?.error || props.order?.error?.length > 0) && (
371
373
  <NotFoundSource
372
374
  btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
373
375
  content={
@@ -351,7 +351,7 @@ const styles = StyleSheet.create({
351
351
  },
352
352
  button: {
353
353
  marginTop: 30,
354
- marginBottom: 0,
354
+ marginBottom: 30,
355
355
  borderRadius: 7.6,
356
356
  borderWidth: 1,
357
357
  shadowOpacity: 0,
@@ -11,7 +11,7 @@ import {
11
11
  ToastType
12
12
  } from 'ordering-components/native';
13
13
  import { OIcon, OText } from '../shared';
14
- import { Dimensions, StyleSheet, Vibration, View } from 'react-native';
14
+ import { Dimensions, StyleSheet, View } from 'react-native';
15
15
  import { InView } from 'react-native-intersection-observer'
16
16
  import { BusinessControllerParams } from '../../types';
17
17
  import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../utils';
@@ -161,7 +161,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
161
161
  }
162
162
 
163
163
  const handleBusinessClick = (selectedBusiness: any) => {
164
- Vibration.vibrate()
164
+ vibrateApp()
165
165
  if (business?.open) handleClick && handleClick(selectedBusiness)
166
166
  else {
167
167
  if (configState?.configs?.preorder_status_enabled?.value === '1') {
@@ -229,17 +229,21 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
229
229
  )}
230
230
  {(!isCustomLayout) && !hideBusinessOffer && (
231
231
  getBusinessOffer((business?.offers)) &&
232
- <OfferBox>
232
+ <OfferBox
233
+ isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}
234
+ isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}
235
+ >
233
236
  <OText
234
237
  size={10}
235
238
  weight={'400'}
239
+ color={theme.colors.textThird}
236
240
  numberOfLines={2}
237
241
  ellipsizeMode='tail'
238
242
  lineHeight={13}
239
243
  >{getBusinessOffer((business?.offers)) || parsePrice(0)}</OText>
240
244
  </OfferBox>
241
245
  )}
242
- <BusinessState>
246
+ <BusinessState isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}>
243
247
  {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
244
248
  <View style={styles.businessStateView}>
245
249
  <OText
@@ -106,7 +106,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
106
106
  <SingleProductCard
107
107
  key={'prod_' + product.id + `_${i}`}
108
108
  isSoldOut={product.inventoried && !product.quantity}
109
- enableIntersection={!isFiltMode && categoryState.products?.length < 80}
109
+ enableIntersection={!isFiltMode}
110
110
  product={product}
111
111
  businessId={businessId}
112
112
  categoryState={categoryState}
@@ -135,7 +135,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
135
135
  key={'feat_' + product.id + `_${i}`}
136
136
  isSoldOut={product.inventoried && !product.quantity}
137
137
  product={product}
138
- enableIntersection={!isFiltMode && categoryState.products?.length < 80}
138
+ enableIntersection={!isFiltMode}
139
139
  businessId={businessId}
140
140
  categoryState={categoryState}
141
141
  onProductClick={onProductClick}
@@ -237,7 +237,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
237
237
  {products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
238
238
  <SingleProductCard
239
239
  key={`${product?.id}_${i}`}
240
- enableIntersection={!isFiltMode && categoryState.products?.length < 80}
240
+ enableIntersection={!isFiltMode}
241
241
  isSoldOut={product.inventoried && !product.quantity}
242
242
  businessId={businessId}
243
243
  product={product}
@@ -45,6 +45,7 @@ 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';
48
49
 
49
50
  const PIXELS_TO_SCROLL = 2000
50
51
 
@@ -322,7 +323,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
322
323
  }
323
324
  }, [isFocused])
324
325
 
325
-
326
326
  useEffect(() => {
327
327
  function onKeyboardDidShow(e: KeyboardEvent) {
328
328
  setKeyboardHeight(e?.endCoordinates?.height);
@@ -53,7 +53,7 @@ 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 } from '../../utils';
56
+ import { getTypesText, vibrateApp } from '../../utils';
57
57
  import { CartStoresListing } from '../CartStoresListing';
58
58
  import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
59
59
 
@@ -46,6 +46,7 @@ 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';
49
50
 
50
51
  const LoginFormUI = (props: LoginParams) => {
51
52
  const {
@@ -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}
@@ -99,7 +99,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
99
99
  return false
100
100
  })
101
101
  setOrders(orders)
102
- }, [_orders?.length])
102
+ }, [JSON.stringify(_orders)])
103
103
 
104
104
  const onProductClick = (product: any) => {
105
105
  if (product?.product_id && product?.category_id && product?.businessId &&
@@ -186,6 +186,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
186
186
  setOrdersLength && setOrdersLength({ ...ordersLength, activeOrdersLength: updateOrders?.length })
187
187
  } else if (!preOrders) {
188
188
  setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
189
+ } else {
190
+ setOrdersLength && setOrdersLength({ ...ordersLength, preordersLength: updateOrders?.length })
189
191
  }
190
192
  }, [_orders, activeOrders, preOrders])
191
193
 
@@ -9,8 +9,7 @@ import {
9
9
  I18nManager,
10
10
  SafeAreaView,
11
11
  Platform,
12
- Button,
13
- Vibration
12
+ Button
14
13
  } from 'react-native';
15
14
  import {
16
15
  ProductForm as ProductOptions,
@@ -56,7 +55,7 @@ import { ProductOptionSubOption } from '../ProductOptionSubOption';
56
55
  import { NotFoundSource } from '../NotFoundSource';
57
56
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
58
57
  import NavBar from '../NavBar';
59
- import { orderTypeList } from '../../utils';
58
+ import { orderTypeList, vibrateApp } from '../../utils';
60
59
  const windowWidth = Dimensions.get('window').width;
61
60
 
62
61
  export const ProductOptionsUI = (props: any) => {
@@ -235,7 +234,7 @@ export const ProductOptionsUI = (props: any) => {
235
234
  };
236
235
 
237
236
  const handleSaveProduct = () => {
238
- Vibration.vibrate()
237
+ vibrateApp()
239
238
  if (!productCart.quantity) {
240
239
  showToast(ToastType.Error, t('VALIDATION_ERROR_REQUIRED', 'The quantity field is required').replace('_attribute_', t('PRODUCT_POTIONS_QUANTITY', 'Quantity')))
241
240
  return
@@ -41,8 +41,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
41
41
  const [showMessage, setShowMessage] = useState(false)
42
42
  const [isDirty, setIsDirty] = useState(false)
43
43
 
44
- const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
45
- const iconsSize = isChewLayout ? 20 : 16
44
+ const iconsSize = 20
46
45
 
47
46
  const handleSuboptionClick = () => {
48
47
  toggleSelect()
@@ -117,7 +116,8 @@ export const ProductOptionSubOptionUI = (props: any) => {
117
116
  <OIcon
118
117
  src={theme.images.general.half_l}
119
118
  color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
120
- width={16}
119
+ width={20}
120
+ height={20}
121
121
  style={styles.inverse}
122
122
  />
123
123
  </Circle>
@@ -125,14 +125,16 @@ export const ProductOptionSubOptionUI = (props: any) => {
125
125
  <OIcon
126
126
  src={theme.images.general.half_f}
127
127
  color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
128
- width={16}
128
+ width={20}
129
+ height={20}
129
130
  />
130
131
  </Circle>
131
132
  <Circle disabled={disabled} onPress={() => changePosition('right')}>
132
133
  <OIcon
133
134
  src={theme.images.general.half_r}
134
135
  color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
135
- width={16}
136
+ width={20}
137
+ height={20}
136
138
  />
137
139
  </Circle>
138
140
  </>
@@ -10,7 +10,7 @@ export const Container = styled.TouchableOpacity`
10
10
  export const IconControl = styled.TouchableOpacity`
11
11
  flex-direction: row;
12
12
  padding: 10px;
13
- width: 45%;
13
+ width: 38%;
14
14
  align-items: center;
15
15
  `
16
16
 
@@ -18,7 +18,7 @@ export const QuantityControl = styled.View`
18
18
  flex-direction: row;
19
19
  align-items: center;
20
20
  justify-content: flex-start;
21
- margin-horizontal: 5px;
21
+ margin-right: 5px;
22
22
  flex: 1;
23
23
  width: 60px;
24
24
  `
@@ -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 } from '../../utils';
41
+ import { sortInputFields, vibrateApp } from '../../utils';
42
42
  import { GoogleLogin } from '../GoogleLogin';
43
43
  import { AppleLogin } from '../AppleLogin';
44
44
 
@@ -68,6 +68,22 @@ const StripeElementsFormUI = (props: any) => {
68
68
  },
69
69
  })
70
70
 
71
+ const styles = StyleSheet.create({
72
+ container: {
73
+ width: '100%',
74
+ paddingHorizontal: 40,
75
+ justifyContent: 'space-between',
76
+ paddingBottom: 12
77
+ },
78
+ btnAddStyle: {
79
+ marginTop: 20,
80
+ borderRadius: 7.6,
81
+ shadowOpacity: 0,
82
+ height: 44,
83
+ marginBottom: isKeyboardShow && Platform.OS === 'ios' ? 40 : 0
84
+ },
85
+ })
86
+
71
87
  let billingDetails: any = {}
72
88
 
73
89
  if (user?.name || user?.lastname) {
@@ -7,11 +7,12 @@ import { SignupForm } from '../SignupForm'
7
7
 
8
8
  import { UDForm, UDLoader, UDWrapper, WrapperPhone } from './styles';
9
9
 
10
- import { OText, OButton, OInput, OModal } from '../shared';
11
- import Alert from '../../providers/AlertProvider'
10
+ import { OText, OButton, OInput, OModal, OIcon } from '../shared';
11
+ import { OAlert } from '../../../../../src/components/shared'
12
12
 
13
13
  import { PhoneInputNumber } from '../PhoneInputNumber';
14
14
  import { sortInputFields } from '../../utils';
15
+ import { ListItem } from '../UserProfile/styles';
15
16
 
16
17
  export const UserFormDetailsUI = (props: any) => {
17
18
  const {
@@ -31,7 +32,9 @@ export const UserFormDetailsUI = (props: any) => {
31
32
  setWillVerifyOtpState,
32
33
  handlePlaceOrderAsGuest,
33
34
  isCheckout,
34
- setIsOpen
35
+ setIsOpen,
36
+ handleRemoveAccount,
37
+ isProfile
35
38
  } = props;
36
39
 
37
40
  const theme = useTheme();
@@ -85,8 +88,9 @@ export const UserFormDetailsUI = (props: any) => {
85
88
  cellphone: null,
86
89
  },
87
90
  });
88
- const [alertState, setAlertState] = useState({ open: false, content: '' })
91
+ const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
89
92
 
93
+ const isAdmin = user?.level === 0
90
94
  const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
91
95
 
92
96
  const handleSuccessSignup = (user: any) => {
@@ -202,6 +206,18 @@ export const UserFormDetailsUI = (props: any) => {
202
206
  handleChangeInput(countryCode, true);
203
207
  }
204
208
 
209
+ const onRemoveAccount = () => {
210
+ setConfirm({
211
+ open: true,
212
+ content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
213
+ title: t('ACCOUNT_ALERT', 'Account alert'),
214
+ handleOnAccept: () => {
215
+ setConfirm({ ...confirm, open: false })
216
+ handleRemoveAccount && handleRemoveAccount(user?.id)
217
+ }
218
+ })
219
+ }
220
+
205
221
  useEffect(() => {
206
222
  if (Object.keys(errors).length > 0) {
207
223
  const list = Object.values(errors);
@@ -408,6 +424,12 @@ export const UserFormDetailsUI = (props: any) => {
408
424
  )}
409
425
  </UDWrapper>
410
426
  )}
427
+ {isProfile && (
428
+ <ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
429
+ <OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
430
+ <OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
431
+ </ListItem>
432
+ )}
411
433
  {validationFields?.loading && (
412
434
  <UDLoader>
413
435
  <OText size={12}>{t('LOADING', 'Loading')}</OText>
@@ -474,7 +496,14 @@ export const UserFormDetailsUI = (props: any) => {
474
496
  />
475
497
  </ScrollView>
476
498
  </OModal>
477
-
499
+ <OAlert
500
+ open={confirm.open}
501
+ title={confirm.title}
502
+ content={confirm.content}
503
+ onAccept={confirm.handleOnAccept}
504
+ onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
505
+ onClose={() => setConfirm({ ...confirm, open: false, title: null })}
506
+ />
478
507
  </>
479
508
  );
480
509
  };
@@ -35,7 +35,6 @@ import {
35
35
  } from './styles';
36
36
  import { useWindowDimensions } from 'react-native';
37
37
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
38
- import styled from 'styled-components';
39
38
  import ToggleSwitch from 'toggle-switch-react-native';
40
39
 
41
40
  const ProfileListUI = (props: ProfileParams) => {
@@ -108,8 +107,6 @@ const ProfileListUI = (props: ProfileParams) => {
108
107
  const [, { showToast }] = useToast();
109
108
  const { errors } = useForm();
110
109
 
111
- const isAdmin = user?.level === 0
112
-
113
110
  const { height } = useWindowDimensions();
114
111
  const { top, bottom } = useSafeAreaInsets();
115
112
 
@@ -143,19 +140,8 @@ const ProfileListUI = (props: ProfileParams) => {
143
140
 
144
141
  const detailProps = {
145
142
  goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
146
- onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
147
- }
148
-
149
- const onRemoveAccount = () => {
150
- setConfirm({
151
- open: true,
152
- content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
153
- title: t('ACCOUNT_ALERT', 'Account alert'),
154
- handleOnAccept: () => {
155
- setConfirm({ ...confirm, open: false })
156
- handleRemoveAccount && handleRemoveAccount(user?.id)
157
- }
158
- })
143
+ onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params),
144
+ handleRemoveAccount
159
145
  }
160
146
 
161
147
  useEffect(() => {
@@ -297,7 +297,7 @@ const ProfileUI = (props: ProfileParams) => {
297
297
  <View style={styles.photo}>
298
298
  {user?.photo ? (
299
299
  <FastImage
300
- style={{ height: 60, width: 80, borderRadius: 8 }}
300
+ style={{ height: 80, width: 80, borderRadius: 8 }}
301
301
  source={{
302
302
  uri: user?.photo,
303
303
  priority: FastImage.priority.normal,
@@ -320,6 +320,7 @@ const ProfileUI = (props: ProfileParams) => {
320
320
  <Spinner visible={formState?.loading || verifyPhoneState?.loading} />
321
321
  <UserFormDetailsUI
322
322
  {...props}
323
+ isProfile
323
324
  isEdit
324
325
  setWillVerifyOtpState={setWillVerifyOtpState}
325
326
  />
@@ -373,8 +373,8 @@ export interface OrdersOptionParams {
373
373
  preOrders?: boolean,
374
374
  reorderState?: any,
375
375
  handleReorder?: (orderId: number) => {},
376
- setOrdersLength?: ({ activeOrdersLength, previousOrdersLength }: { activeOrdersLength: number, previousOrdersLength: number }) => void,
377
- ordersLength: { activeOrdersLength: number, previousOrdersLength: number },
376
+ setOrdersLength?: ({ activeOrdersLength, previousOrdersLength, preordersLength }: { activeOrdersLength: number, previousOrdersLength: number, preordersLength: number }) => void,
377
+ ordersLength: { activeOrdersLength: number, previousOrdersLength: number, preordersLength: number },
378
378
  setSelectedOrderId?: any,
379
379
  setOpenMessges?: any,
380
380
  loadMoreStatus?: boolean,
@@ -4,6 +4,7 @@ import FontAwesome from 'react-native-vector-icons/FontAwesome';
4
4
  import { CODES } from 'ordering-components/native'
5
5
  import { ORDER_TYPES } from '../config/constants';
6
6
  import { useTheme } from 'styled-components/native';
7
+ import ReactNativeHapticFeedback from "react-native-haptic-feedback";
7
8
 
8
9
  const [languageState, t] = useLanguage();
9
10
  const theme = useTheme()
@@ -612,3 +613,13 @@ export const lightenDarkenColor = (color: any) => {
612
613
  return false
613
614
  }
614
615
  }
616
+
617
+ export const vibrateApp = (impact ?: string) => {
618
+ const options = {
619
+ enableVibrateFallback: true,
620
+ ignoreAndroidSystemSettings: false
621
+ };
622
+
623
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
624
+
625
+ }