ordering-ui-react-native 0.15.81 → 0.15.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.15.81",
3
+ "version": "0.15.82",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -51,7 +51,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
51
51
  orderTitle,
52
52
  appTitle,
53
53
  handleClickLogisticOrder,
54
- forceUpdate
54
+ forceUpdate,
55
+ getPermissions
55
56
  } = props;
56
57
  const [, { showToast }] = useToast();
57
58
  const { order } = props.order
@@ -101,9 +102,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
101
102
  };
102
103
 
103
104
  const handleOpenMapView = async () => {
104
- if (permissions?.locationStatus === 'granted') {
105
+ const _permissions = await getPermissions()
106
+
107
+ const isBlocked = _permissions.some((_permission: string) => permissions?.locationStatus?.[_permission] === 'blocked')
108
+ const isGranted = _permissions.reduce((allPermissions: boolean, _permission: string) => allPermissions && permissions?.locationStatus?.[_permission] === 'granted', true)
109
+
110
+ if (isGranted) {
105
111
  setOpenModalForMapView(!openModalForMapView);
106
- } else if (permissions?.locationStatus === 'blocked') {
112
+ } else if (isBlocked) {
107
113
  // redirectToSettings();
108
114
  showToast(
109
115
  ToastType.Error,
@@ -114,8 +120,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
114
120
  );
115
121
  } else {
116
122
  const response = await askLocationPermission();
117
- if (response === 'granted') {
118
- setOpenModalForMapView(!openModalForMapView);
123
+ const isGranted = _permissions.reduce((allPermissions: boolean, _permission: string) => allPermissions && response?.locationStatus?.[_permission] === 'granted', true)
124
+ if (isGranted) {
125
+ setOpenModalForMapView(true)
119
126
  }
120
127
  }
121
128
  };
@@ -373,6 +373,7 @@ export interface OrderDetailsParams {
373
373
  handleClickLogisticOrder?: (status: number, orderId: number) => void;
374
374
  orderTitle?: any;
375
375
  forceUpdate?: number;
376
+ getPermissions?: any
376
377
  }
377
378
  export interface ProductItemAccordionParams {
378
379
  isCartPending?: boolean;
@@ -578,4 +579,4 @@ export interface ReviewCustomerParams {
578
579
 
579
580
  export interface NoNetworkParams {
580
581
  image?: any;
581
- }
582
+ }
@@ -162,7 +162,7 @@ const CartUI = (props: any) => {
162
162
  handleClearProducts={handleClearProducts}
163
163
  handleCartOpen={handleCartOpen}
164
164
  onNavigationRedirect={props.onNavigationRedirect}
165
- handleChangeStore={props.isFranchiseApp ? () => setOpenChangeStore(true) : null}
165
+ handleChangeStore={() => setOpenChangeStore(true)}
166
166
  handleClickCheckout={() => setOpenUpselling(true)}
167
167
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
168
168
  >
@@ -597,21 +597,19 @@ const CheckoutUI = (props: any) => {
597
597
  </OText>
598
598
  </TouchableOpacity>
599
599
  </CartHeader>
600
- {props.isFranchiseApp && (
601
- <TouchableOpacity
602
- onPress={() => setOpenChangeStore(true)}
603
- style={{ alignSelf: 'flex-start' }}
600
+ <TouchableOpacity
601
+ onPress={() => setOpenChangeStore(true)}
602
+ style={{ alignSelf: 'flex-start' }}
603
+ >
604
+ <OText
605
+ size={12}
606
+ lineHeight={18}
607
+ color={theme.colors.textSecondary}
608
+ style={{ textDecorationLine: 'underline' }}
604
609
  >
605
- <OText
606
- size={12}
607
- lineHeight={18}
608
- color={theme.colors.textSecondary}
609
- style={{ textDecorationLine: 'underline' }}
610
- >
611
- {t('CHANGE_STORE', 'Change store')}
612
- </OText>
613
- </TouchableOpacity>
614
- )}
610
+ {t('CHANGE_STORE', 'Change store')}
611
+ </OText>
612
+ </TouchableOpacity>
615
613
  <OrderSummary
616
614
  cart={cart}
617
615
  isCartPending={cart?.status === 2}
@@ -664,7 +662,7 @@ const CheckoutUI = (props: any) => {
664
662
  </View>
665
663
  )}
666
664
  <OModal
667
- open={openChangeStore && props.isFranchiseApp}
665
+ open={openChangeStore}
668
666
  entireModal
669
667
  customClose
670
668
  onClose={() => setOpenChangeStore(false)}
@@ -873,7 +871,7 @@ export const Checkout = (props: any) => {
873
871
  ...props,
874
872
  UIComponent: CheckoutUI,
875
873
  cartState,
876
- [props.isFranchiseApp ? 'uuid' : 'businessId']: props.isFranchiseApp ? cartUuid : cartState.cart?.business_id
874
+ uuid: cartUuid
877
875
  }
878
876
 
879
877
  return (
@@ -39,7 +39,7 @@ const ORDER_STATUS: any = {
39
39
  23: 'ORDER_DRIVER_ON_WAY'
40
40
  }
41
41
 
42
- const filterSpecialStatus = ['prepared_in', 'delivered_in']
42
+ const filterSpecialStatus = ['prepared_in', 'delivered_in', 'delivery_datetime']
43
43
 
44
44
 
45
45
  const MessagesUI = (props: MessagesParams) => {
@@ -93,6 +93,7 @@ const PromotionsUI = (props: PromotionParams) => {
93
93
  titleAlign={'center'}
94
94
  onActionLeft={() => navigation.goBack()}
95
95
  showCall={false}
96
+ style={{ paddingVertical: Platform.OS === 'ios' ? 0 : 20, marginLeft: 20 }}
96
97
  />
97
98
  <PromotionsContainer>
98
99
  <SearchBarContainer>
@@ -2,6 +2,8 @@ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const PromotionsContainer = styled.View`
4
4
  width: 100%;
5
+ padding-left: 40px;
6
+ padding-right: 40px;
5
7
  `
6
8
 
7
9
  export const SingleOfferContainer = styled.View`