ordering-ui-react-native 0.22.31 → 0.22.32-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 (164) hide show
  1. package/package.json +6 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/Checkout/index.tsx +40 -39
  5. package/src/components/StripeMethodForm/index.tsx +4 -2
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/context/OfflineActions/index.tsx +236 -0
  8. package/src/types/index.tsx +2 -1
  9. package/themes/business/index.tsx +2 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
  11. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  12. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  13. package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
  14. package/themes/business/src/components/Chat/index.tsx +15 -3
  15. package/themes/business/src/components/DriverMap/index.tsx +49 -26
  16. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  17. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  18. package/themes/business/src/components/LanguageSelector/index.tsx +1 -4
  19. package/themes/business/src/components/LoginForm/index.tsx +123 -98
  20. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  21. package/themes/business/src/components/MapView/index.tsx +46 -29
  22. package/themes/business/src/components/NewOrderNotification/index.tsx +38 -19
  23. package/themes/business/src/components/OrderDetails/Business.tsx +47 -27
  24. package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
  25. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +156 -46
  26. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +45 -18
  27. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  28. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
  29. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  30. package/themes/business/src/components/OrderSummary/index.tsx +6 -4
  31. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  32. package/themes/business/src/components/OrdersOption/index.tsx +250 -159
  33. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  34. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  35. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +30 -18
  36. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
  38. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  39. package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
  40. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  41. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  42. package/themes/business/src/components/PrinterSettings/index.tsx +162 -174
  43. package/themes/business/src/components/PrinterSettings/styles.tsx +14 -1
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  46. package/themes/business/src/components/StoresList/index.tsx +2 -2
  47. package/themes/business/src/components/UserProfileForm/index.tsx +57 -24
  48. package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
  49. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  50. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  51. package/themes/business/src/config/currency.tsx +1010 -0
  52. package/themes/business/src/hooks/useLocation.tsx +16 -12
  53. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  54. package/themes/business/src/types/index.tsx +18 -5
  55. package/themes/business/src/utils/index.tsx +33 -3
  56. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  58. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  59. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  60. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  61. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  62. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/original/index.tsx +11 -0
  65. package/themes/original/src/components/AddressForm/index.tsx +27 -16
  66. package/themes/original/src/components/AddressList/index.tsx +8 -7
  67. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  68. package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
  69. package/themes/original/src/components/BusinessItemAccordion/index.tsx +14 -6
  70. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
  71. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
  72. package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
  73. package/themes/original/src/components/BusinessPreorder/index.tsx +46 -28
  74. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
  75. package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
  76. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  77. package/themes/original/src/components/BusinessProductsListing/index.tsx +10 -6
  78. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  79. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  80. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  81. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  82. package/themes/original/src/components/Cart/index.tsx +46 -14
  83. package/themes/original/src/components/CartContent/index.tsx +2 -4
  84. package/themes/original/src/components/Checkout/index.tsx +127 -77
  85. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  86. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  87. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  88. package/themes/original/src/components/Favorite/index.tsx +1 -5
  89. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  90. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  91. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  92. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  93. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  94. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
  95. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
  96. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  97. package/themes/original/src/components/Help/index.tsx +2 -0
  98. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  99. package/themes/original/src/components/Home/index.tsx +2 -11
  100. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
  101. package/themes/original/src/components/LoginForm/index.tsx +12 -9
  102. package/themes/original/src/components/MessageListing/index.tsx +2 -1
  103. package/themes/original/src/components/Messages/index.tsx +27 -19
  104. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  105. package/themes/original/src/components/MomentOption/index.tsx +80 -52
  106. package/themes/original/src/components/MomentSelector/index.tsx +5 -2
  107. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  108. package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
  109. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
  110. package/themes/original/src/components/MyOrders/index.tsx +2 -2
  111. package/themes/original/src/components/NavBar/index.tsx +7 -4
  112. package/themes/original/src/components/NetworkError/index.tsx +0 -5
  113. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  114. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  115. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +16 -11
  116. package/themes/original/src/components/OrderDetails/index.tsx +44 -21
  117. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  118. package/themes/original/src/components/OrderProgress/index.tsx +4 -3
  119. package/themes/original/src/components/OrderSummary/index.tsx +29 -10
  120. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  121. package/themes/original/src/components/OrdersOption/index.tsx +3 -6
  122. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  123. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  124. package/themes/original/src/components/PaymentOptions/index.tsx +462 -461
  125. package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
  126. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  127. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  128. package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
  129. package/themes/original/src/components/ProductForm/index.tsx +107 -102
  130. package/themes/original/src/components/ProductItemAccordion/index.tsx +30 -38
  131. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  132. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  133. package/themes/original/src/components/Promotions/index.tsx +6 -9
  134. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  135. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  136. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  137. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  138. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  139. package/themes/original/src/components/Sessions/index.tsx +3 -3
  140. package/themes/original/src/components/SignupForm/index.tsx +102 -88
  141. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
  142. package/themes/original/src/components/SingleProductCard/index.tsx +5 -5
  143. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  144. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  145. package/themes/original/src/components/StripeCardsList/index.tsx +16 -3
  146. package/themes/original/src/components/StripeElementsForm/index.tsx +10 -4
  147. package/themes/original/src/components/StripeElementsForm/naked.tsx +1 -1
  148. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  149. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  150. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
  151. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  152. package/themes/original/src/components/UserDetails/index.tsx +17 -16
  153. package/themes/original/src/components/UserFormDetails/index.tsx +169 -139
  154. package/themes/original/src/components/UserProfile/index.tsx +9 -1
  155. package/themes/original/src/components/UserVerification/index.tsx +15 -4
  156. package/themes/original/src/components/Wallets/index.tsx +6 -3
  157. package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
  158. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  159. package/themes/original/src/components/shared/OButton.tsx +5 -4
  160. package/themes/original/src/components/shared/OInput.tsx +4 -8
  161. package/themes/original/src/components/shared/OModal.tsx +7 -2
  162. package/themes/original/src/types/index.tsx +12 -4
  163. package/themes/original/src/utils/index.tsx +30 -1
  164. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,17 +1,19 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
- import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity } from 'react-native';
3
- import { useLanguage, useUtils, useToast, OrderListGroups, useConfig } from 'ordering-components/native';
2
+ import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity, Animated, Easing } from 'react-native';
3
+ import { useLanguage, useUtils, OrderListGroups, useConfig } from 'ordering-components/native';
4
4
  import SelectDropdown from 'react-native-select-dropdown'
5
5
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
6
6
  import FeatherIcon from 'react-native-vector-icons/Feather';
7
7
  import FontistoIcon from 'react-native-vector-icons/Fontisto'
8
8
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
9
+ import RNRestart from 'react-native-restart'
9
10
 
10
11
  import { useTheme } from 'styled-components/native';
11
12
  import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
12
13
  import { NotificationSetting } from '../../../../../src/components/NotificationSetting'
13
14
  import { NewOrderNotification } from '../NewOrderNotification';
14
15
  import { WebsocketStatus } from '../WebsocketStatus'
16
+ import { _retrieveStoreData, _setStoreData } from '../../providers/StoreUtil'
15
17
 
16
18
  import { OText, OButton, OModal, OInput, OIcon } from '../shared';
17
19
  import { NotFoundSource } from '../NotFoundSource';
@@ -53,6 +55,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
53
55
  navigation,
54
56
  setCurrentFilters,
55
57
  tabs,
58
+ combineTabs,
59
+ setCombineTabsState,
60
+ isNetConnected,
56
61
  currentTabSelected,
57
62
  setCurrentTabSelected,
58
63
  ordersGroup,
@@ -69,7 +74,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
69
74
  logisticOrders,
70
75
  loadLogisticOrders,
71
76
  isLogisticActivated,
72
- isAlsea,
73
77
  handleChangeOrderStatus,
74
78
  handleSendCustomerReview
75
79
  } = props;
@@ -95,6 +99,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
95
99
  const [, t] = useLanguage();
96
100
  const [{ parseDate }] = useUtils()
97
101
  const [configState] = useConfig()
102
+
98
103
  const [orientationState] = useDeviceOrientation();
99
104
  const [openSearchModal, setOpenSearchModal] = useState(false)
100
105
  const [openSLASettingModal, setOpenSLASettingModal] = useState(false)
@@ -124,12 +129,16 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
124
129
  backColor: '#E63757'
125
130
  }
126
131
  ]
127
- const combineTabs = configState?.configs?.combine_pending_and_progress_orders?.value === '1'
128
132
  const [selectedTabStatus, setSelectedTabStatus] = useState<any>(deliveryStatus)
129
133
  const [openedSelect, setOpenedSelect] = useState('')
134
+ const [lastDateConnection, setLastDateConnection] = useState(null)
135
+ const [internetLoading, setInternetLoading] = useState(!isNetConnected && isNetConnected !== null)
130
136
 
131
137
  const HEIGHT_SCREEN = orientationState?.dimensions?.height
132
138
  const IS_PORTRAIT = orientationState.orientation === PORTRAIT
139
+ const showTagsList = !props.isAlsea && !props.isDriverApp && currentTabSelected !== 'logisticOrders'
140
+ const AnimatedFeatherIcon = Animated.createAnimatedComponent(FeatherIcon);
141
+ const spinValue = new Animated.Value(0);
133
142
 
134
143
  const preorderTypeList = [
135
144
  { key: null, name: t('SLA', 'SLA\'s') },
@@ -251,7 +260,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
251
260
  paddingLeft: 0,
252
261
  paddingRight: 0,
253
262
  marginBottom: 30,
254
- marginTop: 30
263
+ marginTop: Platform.OS === 'ios' ? 60 : 30
255
264
  },
256
265
  rowStyle: {
257
266
  display: 'flex',
@@ -380,18 +389,94 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
380
389
  }
381
390
 
382
391
  useEffect(() => {
383
- scrollRefTab.current?.scrollTo({ animated: true });
384
- scrollListRef.current?.scrollTo({ animated: true });
385
- scrollRef.current?.scrollTo({ y: 0, animated: true });
392
+ scrollRefTab.current?.scrollTo();
393
+ scrollListRef.current?.scrollTo();
394
+ scrollRef.current?.scrollTo();
386
395
  setTags({ values: [] })
387
396
  }, [currentTabSelected])
388
397
 
389
- useEffect(() => {
390
- const unsubcribe = navigation.addListener('focus', () => {
391
- currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })
392
- })
393
- return unsubcribe
394
- }, [navigation, loadOrders, loadLogisticOrders])
398
+ useEffect(() => {
399
+ const unsubcribe = navigation.addListener('focus', () => {
400
+ currentTabSelected === 'logisticOrders' && loadLogisticOrders && loadLogisticOrders()
401
+ })
402
+ return unsubcribe
403
+ }, [navigation, loadLogisticOrders])
404
+
405
+ useEffect(() => {
406
+ const orderStatuses = ['active', 'pending', 'inProgress', 'completed', 'cancelled']
407
+
408
+ const manageStoragedOrders = async () => {
409
+ setInternetLoading(true)
410
+ let lastConnection = await _retrieveStoreData('last_date_connection');
411
+ let _combineTabs = await _retrieveStoreData('combine_pending_and_progress_orders')
412
+ let ordersStoraged: any = {}
413
+ for (const status of orderStatuses) {
414
+ ordersStoraged[status] = await _retrieveStoreData(`${status}_orders`) ?? []
415
+ }
416
+
417
+ if (_combineTabs || !_combineTabs && combineTabs) {
418
+ _combineTabs && setCombineTabsState(_combineTabs)
419
+ _setStoreData('combine_pending_and_progress_orders', _combineTabs || combineTabs);
420
+ }
421
+
422
+ if (!lastConnection) {
423
+ const formattedDate = parseDate(new Date())
424
+ lastConnection = formattedDate
425
+ _setStoreData('last_date_connection', formattedDate);
426
+ }
427
+
428
+ lastConnection && setLastDateConnection(lastConnection)
429
+
430
+ if (Object.values(ordersStoraged).every((key: any) => Array.isArray(key) && !key?.length)) {
431
+ for (const status of orderStatuses) {
432
+ ordersStoraged[status] = ordersGroup[status]?.orders
433
+ _setStoreData(`${status}_orders`, ordersGroup[status]?.orders);
434
+ }
435
+ }
436
+
437
+ if (Object.values(ordersStoraged).some((key: any) => Array.isArray(key) && key?.length)) {
438
+ let newOrderGroup = {
439
+ ...ordersGroup
440
+ }
441
+ for (const status of orderStatuses) {
442
+ newOrderGroup[status] = {
443
+ ...ordersGroup[status],
444
+ error: null,
445
+ orders: ordersStoraged[status]
446
+ }
447
+ }
448
+ setOrdersGroup(newOrderGroup)
449
+ }
450
+ setInternetLoading(false)
451
+ };
452
+
453
+ if (isNetConnected) {
454
+ _setStoreData('last_date_connection', null);
455
+ _setStoreData('combine_pending_and_progress_orders', null);
456
+ orderStatuses.forEach((key: any) => _setStoreData(`${key}_orders`, null))
457
+ } else if (isNetConnected === false) {
458
+ manageStoragedOrders()
459
+ }
460
+ }, [isNetConnected]);
461
+
462
+
463
+ const handleInitAnimation = () => {
464
+ Animated.timing(
465
+ spinValue,
466
+ {
467
+ toValue: 1,
468
+ duration: 2000,
469
+ easing: Easing.linear,
470
+ useNativeDriver: true
471
+ }
472
+ ).start()
473
+ }
474
+
475
+ useEffect(() => {
476
+ if (currentOrdersGroup?.loading || logisticOrders?.loading) {
477
+ handleInitAnimation()
478
+ }
479
+ }, [currentOrdersGroup?.loading, logisticOrders?.loading])
395
480
 
396
481
  return (
397
482
  <>
@@ -401,13 +486,23 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
401
486
  <View style={{ marginRight: 10 }}>
402
487
  <WebsocketStatus />
403
488
  </View>
404
- <FeatherIcon
405
- name='refresh-cw'
406
- color={theme.colors.backgroundDark}
407
- size={24}
408
- onPress={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
409
- style={{ marginRight: 20 }}
410
- />
489
+ {isNetConnected && (
490
+ <AnimatedFeatherIcon
491
+ name='refresh-cw'
492
+ color={theme.colors.backgroundDark}
493
+ size={24}
494
+ onPress={() => currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })}
495
+ style={{
496
+ marginRight: 20,
497
+ transform: [{
498
+ rotate: spinValue.interpolate({
499
+ inputRange: [0, 0.3],
500
+ outputRange: ['0deg', '360deg'],
501
+ })
502
+ }]
503
+ }}
504
+ />
505
+ )}
411
506
  <FontistoIcon
412
507
  name='search'
413
508
  color={theme.colors.backgroundDark}
@@ -416,57 +511,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
416
511
  />
417
512
  </IconWrapper>
418
513
  </View>
419
- {configState?.configs?.order_deadlines_enabled?.value === '1' && (
420
- <View style={styles.SLAwrapper}>
421
- {/* <View style={{ flex: 0.5 }}>
422
- <OButton
423
- text={t('SLA_SETTING', 'SLA’s Settings')}
424
- textStyle={{ color: theme.colors.backArrow }}
425
- imgRightSrc={null}
426
- style={{
427
- backgroundColor: theme.colors.inputChat,
428
- borderRadius: 7.6,
429
- zIndex: 10,
430
- borderWidth: 0,
431
- minHeight: 40
432
- }}
433
- onClick={onClickSetting}
434
- />
435
- </View> */}
436
- {/* <View style={{ width: 10, height: '100%' }} /> */}
437
- {/* <View style={{ flex: 0.5, justifyContent: 'center' }}>
438
- <SelectDropdown
439
- defaultButtonText={t('SLA', 'SLA\'s')}
440
- data={preorderTypeList}
441
- onSelect={(selectedItem, index) => {
442
- onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
443
- }}
444
- buttonTextAfterSelection={(selectedItem, index) => {
445
- return selectedItem.name
446
- }}
447
- rowTextForSelection={(item, index) => {
448
- return item.key
449
- }}
450
- buttonStyle={styles.selectOption}
451
- buttonTextStyle={styles.buttonTextStyle}
452
- renderDropdownIcon={isOpened => {
453
- return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
454
- }}
455
- dropdownStyle={styles.dropdownStyle}
456
- dropdownOverlayColor='transparent'
457
- rowStyle={styles.rowStyle}
458
- renderCustomizedRowChild={(item, index) => {
459
- return (
460
- <SlaOption>
461
- {index !== 0 && <OrderStatus timeState={item?.key} />}
462
- <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
463
- </SlaOption>
464
- );
465
- }}
466
- />
467
- </View> */}
468
- </View>
469
- )}
470
514
  <FiltersTab>
471
515
  <ScrollView
472
516
  ref={scrollRefTab}
@@ -521,7 +565,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
521
565
  </ScrollView>
522
566
  </FiltersTab>
523
567
  <View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
524
- {currentTabSelected !== 'logisticOrders' && !isAlsea && (
568
+ {showTagsList && (
525
569
  <View
526
570
  style={{
527
571
  display: 'flex',
@@ -588,6 +632,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
588
632
  </ScrollView>
589
633
  </View>
590
634
  )}
635
+ {isNetConnected === false && lastDateConnection && (
636
+ <View
637
+ style={{
638
+ borderRadius: 8,
639
+ paddingVertical: 3,
640
+ backgroundColor: theme.colors.danger500,
641
+ marginBottom: 10
642
+ }}
643
+ >
644
+ <OText
645
+ style={{ color: 'white', textAlign: 'center' }}
646
+ >
647
+ {`${t('LAST_UPDATE', 'Last Update')}: ${lastDateConnection}`}
648
+ </OText>
649
+ </View>
650
+ )}
591
651
  <ScrollView
592
652
  ref={scrollListRef}
593
653
  showsVerticalScrollIndicator={false}
@@ -596,13 +656,14 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
596
656
  refreshControl={
597
657
  <RefreshControl
598
658
  refreshing={refreshing}
599
- onRefresh={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
659
+ onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })) }}
600
660
  />
601
661
  }
602
662
  >
603
663
  {!currentOrdersGroup?.error?.length &&
604
664
  currentOrdersGroup?.orders?.length > 0 &&
605
665
  currentTabSelected !== 'logisticOrders' &&
666
+ !currentOrdersGroup?.loading &&
606
667
  (
607
668
  <PreviousOrders
608
669
  orders={ordersFormatted}
@@ -621,7 +682,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
621
682
  />
622
683
  )}
623
684
  {!logisticOrders?.error?.length &&
624
- logisticOrders?.orders?.length > 0 &&
685
+ logisticOrders && logisticOrders?.orders?.length > 0 &&
686
+ !logisticOrders?.loading &&
625
687
  currentTabSelected === 'logisticOrders' && (
626
688
  <PreviousOrders
627
689
  orders={logisticOrders?.orders?.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
@@ -633,42 +695,47 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
633
695
  />
634
696
  )
635
697
  }
636
- {((currentOrdersGroup?.loading ||
637
- currentOrdersGroup?.pagination?.total === null) ||
638
- (logisticOrders?.loading)) &&
698
+ {(
639
699
  (
640
- <>
641
- <View>
642
- {[...Array(5)].map((_, i) => (
643
- <Placeholder key={i} Animation={Fade}>
644
- <View
700
+ (
701
+ currentOrdersGroup?.loading ||
702
+ (currentOrdersGroup?.pagination?.total === null && isNetConnected) ||
703
+ logisticOrders?.loading
704
+ ) &&
705
+ !currentOrdersGroup?.error?.length
706
+ ) || internetLoading
707
+ ) && (
708
+ <View style={{ marginTop: 10 }}>
709
+ {[...Array(5)].map((_, i) => (
710
+ <Placeholder key={i} Animation={Fade}>
711
+ <View
712
+ style={{
713
+ width: '100%',
714
+ flexDirection: 'row',
715
+ marginBottom: 10,
716
+ }}>
717
+ <PlaceholderLine
718
+ width={IS_PORTRAIT ? 22 : 11}
719
+ height={74}
645
720
  style={{
646
- width: '100%',
647
- flexDirection: 'row',
648
- marginBottom: 10,
649
- }}>
650
- <PlaceholderLine
651
- width={IS_PORTRAIT ? 22 : 11}
652
- height={74}
653
- style={{
654
- marginRight: 20,
655
- marginBottom: 20,
656
- borderRadius: 7.6,
657
- }}
658
- />
659
- <Placeholder>
660
- <PlaceholderLine width={30} style={{ marginTop: 5 }} />
661
- <PlaceholderLine width={50} />
662
- <PlaceholderLine width={20} />
663
- </Placeholder>
664
- </View>
665
- </Placeholder>
666
- ))}
667
- </View>
668
- </>
721
+ marginRight: 20,
722
+ marginBottom: 20,
723
+ borderRadius: 7.6,
724
+ }}
725
+ />
726
+ <Placeholder>
727
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
728
+ <PlaceholderLine width={50} />
729
+ <PlaceholderLine width={20} />
730
+ </Placeholder>
731
+ </View>
732
+ </Placeholder>
733
+ ))}
734
+ </View>
669
735
  )}
670
736
 
671
- {!currentOrdersGroup?.error?.length &&
737
+ {isNetConnected &&
738
+ !currentOrdersGroup?.error?.length &&
672
739
  !currentOrdersGroup?.loading &&
673
740
  currentOrdersGroup?.pagination?.totalPages &&
674
741
  currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
@@ -685,33 +752,35 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
685
752
  />
686
753
  )}
687
754
 
688
- {((!currentOrdersGroup?.loading &&
689
- (currentOrdersGroup?.error?.length ||
690
- currentOrdersGroup?.orders?.length === 0)) ||
691
- (currentTabSelected === 'logisticOrders' &&
692
- (logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired)))
693
- ) &&
755
+ {!internetLoading &&
756
+ ((!currentOrdersGroup?.loading &&
757
+ (currentOrdersGroup?.error?.length ||
758
+ currentOrdersGroup?.orders?.length === 0)) ||
759
+ (currentTabSelected === 'logisticOrders' &&
760
+ (logisticOrders && !logisticOrders?.loading && (logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired))))
761
+ ) &&
694
762
  (
695
763
  <NotFoundSource
696
764
  content={
697
- ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
698
- (currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
699
- ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
700
- : currentOrdersGroup?.error?.[0]?.message ||
701
- currentOrdersGroup?.error?.[0] ||
702
- (currentTabSelected === 'logisticOrders' && logisticOrders?.error) ||
703
- t('NETWORK_ERROR', 'Network Error')
765
+ !isNetConnected ? t('NETWORK_ERROR', 'Network Error') :
766
+ ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
767
+ (currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
768
+ ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
769
+ : currentOrdersGroup?.error?.[0]?.message ||
770
+ currentOrdersGroup?.error?.[0] ||
771
+ (currentTabSelected === 'logisticOrders' && logisticOrders?.error) ||
772
+ t('NETWORK_ERROR', 'Network Error')
704
773
  }
705
774
  image={theme.images.general.notFound}
706
775
  conditioned={false}
776
+ btnTitle={!isNetConnected && t('REFRESH', 'Refresh')}
777
+ onClickButton={!isNetConnected && (() => RNRestart.Restart())}
707
778
  />
708
779
  )}
709
780
  </ScrollView>
710
781
  </View>
711
782
 
712
- {isBusinessApp && (
713
- <NewOrderNotification isBusinessApp={isBusinessApp} />
714
- )}
783
+ <NewOrderNotification isBusinessApp={isBusinessApp} />
715
784
 
716
785
  {(openSearchModal || openSLASettingModal) && (
717
786
  <OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
@@ -724,39 +793,41 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
724
793
  {openSearchModal && (
725
794
  <SearchModalContent>
726
795
  <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
727
- <InputContainer style={{ marginBottom: 24 }}>
728
- <SelectDropdown
729
- defaultButtonText={search?.timeStatus
730
- ? preorderTypeList.find(type => type.key === search?.timeStatus)?.name
731
- : t('SLA', 'SLA\'s')}
732
- data={preorderTypeList}
733
- onSelect={(selectedItem, index) => {
734
- setSearch({ ...search, timeStatus: selectedItem?.key })
735
- }}
736
- buttonTextAfterSelection={(selectedItem, index) => {
737
- return selectedItem.name
738
- }}
739
- rowTextForSelection={(item, index) => {
740
- return item.key
741
- }}
742
- buttonStyle={styles.selectOption}
743
- buttonTextStyle={styles.buttonTextStyle}
744
- renderDropdownIcon={isOpened => {
745
- return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
746
- }}
747
- dropdownStyle={styles.dropdownStyle}
748
- dropdownOverlayColor='transparent'
749
- rowStyle={styles.rowStyle}
750
- renderCustomizedRowChild={(item, index) => {
751
- return (
752
- <SlaOption>
753
- {index !== 0 && <OrderStatus timeState={item?.key} />}
754
- <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
755
- </SlaOption>
756
- );
757
- }}
758
- />
759
- </InputContainer>
796
+ {configState?.configs?.order_deadlines_enabled?.value === '1' && (
797
+ <InputContainer style={{ marginBottom: 24 }}>
798
+ <SelectDropdown
799
+ defaultButtonText={search?.timeStatus
800
+ ? preorderTypeList.find(type => type.key === search?.timeStatus)?.name
801
+ : t('SLA', 'SLA\'s')}
802
+ data={preorderTypeList}
803
+ onSelect={(selectedItem, index) => {
804
+ setSearch({ ...search, timeStatus: selectedItem?.key })
805
+ }}
806
+ buttonTextAfterSelection={(selectedItem, index) => {
807
+ return selectedItem.name
808
+ }}
809
+ rowTextForSelection={(item, index) => {
810
+ return item.key
811
+ }}
812
+ buttonStyle={styles.selectOption}
813
+ buttonTextStyle={styles.buttonTextStyle}
814
+ renderDropdownIcon={isOpened => {
815
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
816
+ }}
817
+ dropdownStyle={styles.dropdownStyle}
818
+ dropdownOverlayColor='transparent'
819
+ rowStyle={styles.rowStyle}
820
+ renderCustomizedRowChild={(item, index) => {
821
+ return (
822
+ <SlaOption>
823
+ {index !== 0 && <OrderStatus timeState={item?.key} />}
824
+ <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
825
+ </SlaOption>
826
+ );
827
+ }}
828
+ />
829
+ </InputContainer>
830
+ )}
760
831
  <InputContainer>
761
832
  <OInput
762
833
  value={search.id}
@@ -985,12 +1056,16 @@ export const OrdersOption = (props: OrdersOptionParams) => {
985
1056
  const [, t] = useLanguage();
986
1057
  const [configState] = useConfig()
987
1058
  const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
988
- const combineTabs = configState?.configs?.combine_pending_and_progress_orders?.value === '1'
1059
+
1060
+ const getCombineTabsStoraged = async () => await _retrieveStoreData('combine_pending_and_progress_orders')
1061
+ const combineTabs = typeof configState?.configs?.combine_pending_and_progress_orders === 'object' ? configState?.configs?.combine_pending_and_progress_orders?.value === '1' : getCombineTabsStoraged()
1062
+
989
1063
  const ordersProps = {
990
1064
  ...props,
991
1065
  UIComponent: OrdersOptionUI,
992
1066
  useDefualtSessionManager: true,
993
1067
  asDashboard: true,
1068
+ combineTabs,
994
1069
  isIos: Platform.OS === 'ios',
995
1070
  orderStatus: [
996
1071
  { key: 0, text: t('PENDING', 'Pending') },
@@ -1070,13 +1145,25 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1070
1145
  {
1071
1146
  key: 23,
1072
1147
  text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
1148
+ },
1149
+ {
1150
+ key: 24,
1151
+ text: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order')
1152
+ },
1153
+ {
1154
+ key: 25,
1155
+ text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
1156
+ },
1157
+ {
1158
+ key: 26,
1159
+ text: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer')
1073
1160
  }
1074
1161
  ],
1075
1162
  tabs: combineTabs ? [
1076
1163
  {
1077
1164
  key: 0,
1078
1165
  text: t('ACTIVE', 'Active'),
1079
- tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
1166
+ tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
1080
1167
  title: 'active',
1081
1168
  },
1082
1169
  {
@@ -1102,7 +1189,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1102
1189
  {
1103
1190
  key: 1,
1104
1191
  text: t('IN_PROGRESS', 'In Progress'),
1105
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
1192
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
1106
1193
  title: 'inProgress',
1107
1194
  },
1108
1195
  {
@@ -1128,3 +1215,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1128
1215
  )}
1129
1216
  </>);
1130
1217
  };
1218
+
1219
+ OrdersOption.defaultProps = {
1220
+ isNetConnected: true
1221
+ }
@@ -6,7 +6,7 @@ import { useTheme } from 'styled-components/native';
6
6
  import { Wrapper } from './styles';
7
7
  import { OText, OIcon } from '../shared';
8
8
  import { PhoneInputParams } from '../../types';
9
- import { transformCountryCode } from '../../utils';
9
+ import { transformCountryCode, findExitingCode } from '../../utils';
10
10
 
11
11
  export const PhoneInputNumber = (props: PhoneInputParams) => {
12
12
  const {
@@ -97,10 +97,13 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
97
97
  containerStyle={{ width: '100%' }}
98
98
  ref={phoneInput}
99
99
  defaultValue={userphoneNumber || defaultValue}
100
- defaultCode={
101
- defaultCode
102
- ? transformCountryCode(defaultCode)
103
- : configs?.default_country_code?.value
100
+ defaultCode={defaultCode ?
101
+ !isNaN(defaultCode)
102
+ ? transformCountryCode(defaultCode)
103
+ : findExitingCode(defaultCode)
104
+ : !isNaN((configs?.default_country_code?.value || '')?.replace(/\+/g, ''))
105
+ ? transformCountryCode((configs?.default_country_code?.value || '')?.replace(/\+/g, ''))
106
+ : findExitingCode(configs?.default_country_code?.value?.toUpperCase())
104
107
  }
105
108
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
106
109
  countryPickerProps={{
@@ -1,5 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { StyleSheet, TouchableOpacity, FlatList, RefreshControl } from 'react-native';
3
+ import FastImage from 'react-native-fast-image';
3
4
  import { useTheme } from 'styled-components/native';
4
5
  import { useLanguage, useUtils } from 'ordering-components/native';
5
6
  import { Card, Logo, Information, Header, Badge } from './styles';
@@ -201,6 +202,24 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
201
202
  value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
202
203
  slug: 'ORDER_DRIVER_ON_WAY',
203
204
  percentage: 45
205
+ },
206
+ {
207
+ key: 24,
208
+ value: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
209
+ slug: 'ORDER_DRIVER_WAITING_FOR_ORDER',
210
+ percentage: 25
211
+ },
212
+ {
213
+ key: 25,
214
+ value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
215
+ slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
216
+ percentage: 25
217
+ },
218
+ {
219
+ key: 26,
220
+ value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer'),
221
+ slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER',
222
+ percentage: 80
204
223
  }
205
224
  ];
206
225
 
@@ -284,10 +303,14 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
284
303
  activeOpacity={1}>
285
304
  <Card key={order?.id}>
286
305
  <Logo style={styles.logo}>
287
- <OIcon
288
- url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
289
- src={!order?.business?.logo && theme?.images?.dummies?.businessLogo}
306
+ <FastImage
290
307
  style={styles.icon}
308
+ source={order.business?.logo?.includes('https') ? {
309
+ uri: order.business?.logo,
310
+ priority: FastImage.priority.high,
311
+ cache: FastImage.cacheControl.immutable
312
+ } : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
313
+ resizeMode={FastImage.resizeMode.cover}
291
314
  />
292
315
  </Logo>
293
316
  <Information>