ordering-ui-react-native 0.16.4 → 0.16.5

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.16.4",
3
+ "version": "0.16.5",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -323,6 +323,12 @@ export const OrderContentComponent = (props: OrderContent) => {
323
323
  {order?.customer?.zipcode}
324
324
  </OText>
325
325
  )}
326
+
327
+ {!!order?.on_behalf_of && (
328
+ <OText numberOfLines={1} mBottom={4} ellipsizeMode="tail">
329
+ {t('ON_BEHALF_OF', 'On behalf of')}{': '} {order?.on_behalf_of}
330
+ </OText>
331
+ )}
326
332
  {((order?.delivery_option !== undefined && order?.delivery_type === 1) || !!order?.comment) && (
327
333
  <View style={{ marginTop: 10 }}>
328
334
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
-
2
+ import { _retrieveStoreData } from '../../../../../src/providers/StoreUtil';
3
3
  import {
4
4
  Checkout as CheckoutController,
5
5
  useOrder,
@@ -35,10 +35,18 @@ const CheckoutUI = (props: any) => {
35
35
  } = props
36
36
 
37
37
  const [errorCash, setErrorCash] = useState(false);
38
+ const [customerName, setCustomerName] = useState(null);
39
+
40
+ const getCustomerName = async () => {
41
+ const data = await _retrieveStoreData('customer_name');
42
+ setCustomerName(data?.customerName)
43
+ }
38
44
 
39
45
  useEffect(() => {
40
46
  if (!cartState.loading && cart && !cart?.valid && cart?.status === 2) {
41
47
  navigation?.canGoBack() && navigation.goBack()
48
+ } else {
49
+ getCustomerName()
42
50
  }
43
51
  }, [cart])
44
52
 
@@ -48,6 +56,7 @@ const CheckoutUI = (props: any) => {
48
56
  navigation={navigation}
49
57
  cart={cart}
50
58
  errors={errors}
59
+ customerName={customerName}
51
60
  onPaymentChange={handlePaymethodChange}
52
61
  onNavigationRedirect={onNavigationRedirect}
53
62
  paySelected={paymethodSelected}
@@ -110,7 +119,7 @@ export const Checkout = (props: any) => {
110
119
  loading: false,
111
120
  cart: result
112
121
  })
113
- } catch (error) {
122
+ } catch (error: any) {
114
123
  showToast(ToastType.Error, error?.toString() || error.message)
115
124
  }
116
125
  } else {
@@ -122,7 +131,7 @@ export const Checkout = (props: any) => {
122
131
  error: cart ? null : result
123
132
  })
124
133
  }
125
- } catch (e) {
134
+ } catch (e: any) {
126
135
  setCartState({
127
136
  ...cartState,
128
137
  loading: false,
@@ -113,12 +113,6 @@ const CustomerName = (props: Props): React.ReactElement => {
113
113
  style={{ bottom: 20 }}
114
114
  >
115
115
  {t('WHATS_YOUR_NAME', "What's your name?")}
116
- {/* <OText
117
- size={orientationState?.dimensions?.width * 0.05}
118
- weight={'700'}
119
- >
120
- {`${t('ORDER_BE_FOR', 'order be for?')}`}
121
- </OText> */}
122
116
  </OText>
123
117
  <Controller
124
118
  control={control}
@@ -395,7 +395,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
395
395
  </View>
396
396
  </OSTable>
397
397
 
398
- {order?.products?.length && (
398
+ {order?.products?.length > 0 && (
399
399
  <>
400
400
  <View
401
401
  style={{
@@ -598,7 +598,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
598
598
  <>
599
599
  <Spinner visible={!order || Object.keys(order).length === 0} />
600
600
 
601
- {order && Object.keys(order).length > 0 && (
601
+ {!!order && Object.keys(order).length > 0 && (
602
602
  <>
603
603
  <Container>
604
604
  <NavBar
@@ -107,7 +107,7 @@ const PaymentOptionsUI = (props: any) => {
107
107
 
108
108
  const handlePlaceOrder = () => {
109
109
  if (!userErrors.length) {
110
- handlerClickPlaceOrder && handlerClickPlaceOrder();
110
+ handlerClickPlaceOrder && handlerClickPlaceOrder(null, { on_behalf_of: props.customerName });
111
111
  return;
112
112
  }
113
113
  let stringError = '';
@@ -269,7 +269,7 @@ const CheckoutUI = (props: any) => {
269
269
  onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
270
270
  showCall={false}
271
271
  btnStyle={{ paddingLeft: 0 }}
272
- style={{ flexDirection: 'column', alignItems: 'flex-start', marginTop: Platform.OS === 'ios' ? 0 : 20 }}
272
+ style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
273
273
  titleWrapStyle={{ paddingHorizontal: 0 }}
274
274
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
275
275
  />