ordering-ui-react-native 0.21.73 → 0.21.74

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.21.73",
3
+ "version": "0.21.74",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -389,6 +389,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
389
389
  <View style={styles.header}>
390
390
  <OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
391
391
  <IconWrapper>
392
+ <View style={{ marginRight: 10 }}>
393
+ <WebsocketStatus />
394
+ </View>
392
395
  <FeatherIcon
393
396
  name='refresh-cw'
394
397
  color={theme.colors.backgroundDark}
@@ -404,10 +407,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
404
407
  />
405
408
  </IconWrapper>
406
409
  </View>
407
- <WebsocketStatus />
408
410
  {configState?.configs?.order_deadlines_enabled?.value === '1' && (
409
411
  <View style={styles.SLAwrapper}>
410
- <View style={{ flex: 0.5 }}>
412
+ {/* <View style={{ flex: 0.5 }}>
411
413
  <OButton
412
414
  text={t('SLA_SETTING', 'SLA’s Settings')}
413
415
  textStyle={{ color: theme.colors.backArrow }}
@@ -421,9 +423,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
421
423
  }}
422
424
  onClick={onClickSetting}
423
425
  />
424
- </View>
425
- <View style={{ width: 10, height: '100%' }} />
426
- <View style={{ flex: 0.5, justifyContent: 'center' }}>
426
+ </View> */}
427
+ {/* <View style={{ width: 10, height: '100%' }} /> */}
428
+ {/* <View style={{ flex: 0.5, justifyContent: 'center' }}>
427
429
  <SelectDropdown
428
430
  defaultButtonText={t('SLA', 'SLA\'s')}
429
431
  data={preorderTypeList}
@@ -453,7 +455,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
453
455
  );
454
456
  }}
455
457
  />
456
- </View>
458
+ </View> */}
457
459
  </View>
458
460
  )}
459
461
  <FiltersTab>
@@ -713,6 +715,39 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
713
715
  {openSearchModal && (
714
716
  <SearchModalContent>
715
717
  <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
718
+ <InputContainer style={{ marginBottom: 24 }}>
719
+ <SelectDropdown
720
+ defaultButtonText={search?.timeStatus
721
+ ? preorderTypeList.find(type => type.key === search?.timeStatus)?.name
722
+ : t('SLA', 'SLA\'s')}
723
+ data={preorderTypeList}
724
+ onSelect={(selectedItem, index) => {
725
+ setSearch({ ...search, timeStatus: selectedItem?.key })
726
+ }}
727
+ buttonTextAfterSelection={(selectedItem, index) => {
728
+ return selectedItem.name
729
+ }}
730
+ rowTextForSelection={(item, index) => {
731
+ return item.key
732
+ }}
733
+ buttonStyle={styles.selectOption}
734
+ buttonTextStyle={styles.buttonTextStyle}
735
+ renderDropdownIcon={isOpened => {
736
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
737
+ }}
738
+ dropdownStyle={styles.dropdownStyle}
739
+ dropdownOverlayColor='transparent'
740
+ rowStyle={styles.rowStyle}
741
+ renderCustomizedRowChild={(item, index) => {
742
+ return (
743
+ <SlaOption>
744
+ {index !== 0 && <OrderStatus timeState={item?.key} />}
745
+ <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
746
+ </SlaOption>
747
+ );
748
+ }}
749
+ />
750
+ </InputContainer>
716
751
  <InputContainer>
717
752
  <OInput
718
753
  value={search.id}
@@ -153,10 +153,10 @@ export const OrderItem = React.memo((props: any) => {
153
153
  <Logo style={styles.logo}>
154
154
  <FastImage
155
155
  style={styles.icon}
156
- source={order.business?.logo ? {
157
- uri: optimizeImage(order.business?.logo, 'h_100,c_limit'),
156
+ source={order.business?.logo?.includes('https') ? {
157
+ uri: order.business?.logo,
158
158
  priority: FastImage.priority.normal,
159
- } : theme?.images?.dummies?.businessLogo}
159
+ } : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
160
160
  resizeMode={FastImage.resizeMode.cover}
161
161
  />
162
162
  </Logo>
@@ -46,11 +46,10 @@ const ProfileUI = (props: ProfileParams) => {
46
46
  toggleIsEdit,
47
47
  cleanFormState,
48
48
  handleToggleAvalaibleStatusDriver,
49
- userState,
50
49
  isAlsea
51
50
  } = props;
52
51
 
53
- const [{ user }] = useSession();
52
+ const [{ user, sessionLoading }] = useSession();
54
53
  const [, t] = useLanguage();
55
54
  const [, { showToast }] = useToast();
56
55
  const [{ optimizeImage }] = useUtils();
@@ -67,6 +66,7 @@ const ProfileUI = (props: ProfileParams) => {
67
66
  },
68
67
  });
69
68
  const [phoneUpdate, setPhoneUpdate] = useState(false);
69
+ const [userState, setUserState] = useState(props.userState)
70
70
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
71
71
  const [phoneToShow, setPhoneToShow] = useState('');
72
72
  const [openModal, setOpenModal] = useState(false)
@@ -207,6 +207,22 @@ const ProfileUI = (props: ProfileParams) => {
207
207
  }
208
208
  }, [user?.country_phone_code]);
209
209
 
210
+ useEffect(() => {
211
+ setUserState({ ...userState, ...props.userState })
212
+ }, [props.userState])
213
+
214
+ useEffect(() => {
215
+ if (!user?.id) return
216
+
217
+ setUserState({
218
+ ...userState,
219
+ result: {
220
+ error: true,
221
+ result: user
222
+ }
223
+ })
224
+ }, [user, props.isFocused])
225
+
210
226
  const styles = StyleSheet.create({
211
227
  label: {
212
228
  color: theme.colors.textGray,
@@ -255,7 +271,7 @@ const ProfileUI = (props: ProfileParams) => {
255
271
  />
256
272
  )}
257
273
 
258
- {formState?.loading && !validationFields.error && (
274
+ {(formState?.loading || sessionLoading) && !validationFields.error && (
259
275
  <View
260
276
  style={{
261
277
  backgroundColor: theme.colors.backgroundLight,
@@ -326,7 +342,7 @@ const ProfileUI = (props: ProfileParams) => {
326
342
  </View>
327
343
  )}
328
344
 
329
- {!formState?.loading && !validationFields.error && (
345
+ {!(formState?.loading || sessionLoading) && !validationFields.error && (
330
346
  <ScrollView showsVerticalScrollIndicator={false} style={{ flex: 1 }}>
331
347
  <CenterView>
332
348
  <OIcon
@@ -51,7 +51,7 @@ const SocketStatusUI = (props: any) => {
51
51
  return '#E63757';
52
52
  default:
53
53
  return '#FF9922';
54
- }
54
+ }
55
55
  }
56
56
 
57
57
  return (
@@ -73,7 +73,7 @@ const SocketStatusUI = (props: any) => {
73
73
  <OText
74
74
  style={{ color: theme.colors.backArrow, fontSize: 16, marginBottom: 0, lineHeight: 16 }}
75
75
  >
76
- {t('CONNECTION_STATUS', 'Connection status')}
76
+ {t('CONNECTION_STATUS_SHORT', 'Status')}
77
77
  </OText>
78
78
  <MaterialIcon
79
79
  name='circle'
@@ -58,6 +58,7 @@ export interface ProfileParams {
58
58
  isRequiredField?: any;
59
59
  isAlsea?: boolean;
60
60
  isShowDriverStatus?: boolean;
61
+ isFocused?: boolean;
61
62
  }
62
63
 
63
64
  export interface AddressListParams {
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect, useCallback, useRef } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard } from 'react-native';
2
+ import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler } from 'react-native';
3
3
  import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
4
  import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
5
5
  import Picker from 'react-native-country-picker-modal';
@@ -159,7 +159,7 @@ const CheckoutUI = (props: any) => {
159
159
  const [phoneUpdate, setPhoneUpdate] = useState(false);
160
160
  const [openChangeStore, setOpenChangeStore] = useState(false)
161
161
  const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
162
- const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
162
+ const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
163
163
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
164
164
  const [isOpen, setIsOpen] = useState(false)
165
165
  const [requiredFields, setRequiredFields] = useState<any>([])
@@ -431,6 +431,21 @@ const CheckoutUI = (props: any) => {
431
431
  }
432
432
  }, [])
433
433
 
434
+ useEffect(() => {
435
+ const onBackFunction = () => {
436
+ if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
437
+ setShowGateway({ open: false, closedByUser: true })
438
+ return true
439
+ } else {
440
+ return false
441
+ }
442
+ }
443
+ BackHandler.addEventListener('hardwareBackPress', onBackFunction)
444
+ return () => {
445
+ BackHandler.removeEventListener('hardwareBackPress', onBackFunction)
446
+ }
447
+ }, [BackHandler, webviewPaymethod?.gateway, showGateway.open])
448
+
434
449
  return (
435
450
  <>
436
451
  <View style={styles.wrapperNavbar}>
@@ -368,7 +368,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
368
368
  }, [order?.delivery_type])
369
369
 
370
370
  return (
371
- <SafeAreaView>
371
+ <>
372
372
  <View style={styles.wrapperNavbar}>
373
373
  <TopHeader>
374
374
  <>
@@ -1125,8 +1125,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1125
1125
  />
1126
1126
  </OModal>
1127
1127
  </OrderDetailsContainer>
1128
- </SafeAreaView>
1129
-
1128
+ </>
1130
1129
  );
1131
1130
  };
1132
1131