ordering-ui-react-native 0.14.84 → 0.14.85-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 (149) hide show
  1. package/package.json +6 -3
  2. package/src/DeliveryApp.tsx +34 -2
  3. package/src/assets/images/no-network.png +0 -0
  4. package/src/components/BusinessTypeFilter/index.tsx +9 -2
  5. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Cart/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +0 -1
  9. package/src/components/Home/index.tsx +3 -5
  10. package/src/components/LanguageSelector/index.tsx +65 -97
  11. package/src/components/LanguageSelector/styles.tsx +4 -17
  12. package/src/components/Messages/index.tsx +38 -30
  13. package/src/components/MomentOption/index.tsx +3 -1
  14. package/src/components/OrderDetails/index.tsx +29 -6
  15. package/src/components/OrdersOption/index.tsx +4 -2
  16. package/src/components/PaymentOptions/index.tsx +7 -16
  17. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  18. package/src/components/ProductForm/index.tsx +1 -1
  19. package/src/components/ProductForm/styles.tsx +1 -0
  20. package/src/components/StripeElementsForm/index.tsx +27 -48
  21. package/src/components/UserProfileForm/index.tsx +35 -1
  22. package/src/components/VerifyPhone/styles.tsx +1 -2
  23. package/src/config.json +0 -2
  24. package/src/pages/Checkout.tsx +1 -1
  25. package/src/providers/AlertProvider.tsx +4 -1
  26. package/src/theme.json +2 -1
  27. package/src/types/index.tsx +2 -9
  28. package/src/utils/index.tsx +196 -1
  29. package/themes/business/index.tsx +4 -0
  30. package/themes/business/src/components/Chat/index.tsx +32 -31
  31. package/themes/business/src/components/NetworkError/index.tsx +61 -0
  32. package/themes/business/src/components/NetworkError/styles.tsx +11 -0
  33. package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
  35. package/themes/business/src/components/OrdersListManager/index.tsx +871 -0
  36. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  37. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  38. package/themes/business/src/components/OrdersOption/index.tsx +354 -54
  39. package/themes/business/src/components/OrdersOption/styles.tsx +95 -7
  40. package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
  41. package/themes/business/src/components/PreviousOrders/index.tsx +65 -46
  42. package/themes/business/src/components/PreviousOrders/styles.tsx +5 -10
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +11 -8
  44. package/themes/business/src/types/index.tsx +4 -0
  45. package/themes/business/src/utils/index.tsx +12 -0
  46. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  48. package/themes/doordash/src/components/OrderDetails/index.tsx +3 -1
  49. package/themes/doordash/src/components/OrdersOption/index.tsx +4 -2
  50. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/instacart/src/components/OrderDetails/index.tsx +3 -1
  52. package/themes/instacart/src/components/OrdersOption/index.tsx +4 -2
  53. package/themes/kiosk/index.tsx +2 -0
  54. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  55. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  56. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
  57. package/themes/kiosk/src/components/Cart/index.tsx +1 -1
  58. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  59. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  60. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  61. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  62. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
  63. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  64. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  65. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  66. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  67. package/themes/kiosk/src/components/NetworkError/index.tsx +60 -0
  68. package/themes/kiosk/src/components/NetworkError/styles.tsx +11 -0
  69. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  70. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  71. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  72. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  73. package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
  74. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  75. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  76. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  77. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  78. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  79. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  80. package/themes/kiosk/src/types/index.d.ts +4 -0
  81. package/themes/original/index.tsx +26 -6
  82. package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +11 -7
  84. package/themes/original/src/components/BusinessController/index.tsx +2 -2
  85. package/themes/original/src/components/BusinessMenuList/index.tsx +4 -2
  86. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -2
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +50 -6
  88. package/themes/original/src/components/BusinessProductsListing/index.tsx +13 -10
  89. package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
  90. package/themes/original/src/components/BusinessesListing/index.tsx +1 -1
  91. package/themes/original/src/components/Cart/index.tsx +43 -10
  92. package/themes/original/src/components/Checkout/index.tsx +54 -17
  93. package/themes/original/src/components/Checkout/styles.tsx +7 -0
  94. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  95. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  96. package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
  97. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +9 -2
  98. package/themes/original/src/components/LastOrder/index.tsx +3 -1
  99. package/themes/original/src/components/LoginForm/index.tsx +83 -68
  100. package/themes/original/src/components/MessageListing/index.tsx +4 -2
  101. package/themes/original/src/components/Messages/index.tsx +19 -21
  102. package/themes/original/src/components/MomentOption/index.tsx +127 -152
  103. package/themes/original/src/components/MomentOption/styles.tsx +42 -18
  104. package/themes/original/src/components/NetworkError/index.tsx +61 -0
  105. package/themes/original/src/components/NetworkError/styles.tsx +11 -0
  106. package/themes/original/src/components/OrderDetails/index.tsx +106 -113
  107. package/themes/original/src/components/OrderProgress/index.tsx +6 -5
  108. package/themes/original/src/components/OrderSummary/index.tsx +34 -1
  109. package/themes/original/src/components/OrdersOption/index.tsx +20 -42
  110. package/themes/original/src/components/OrdersOption/styles.tsx +0 -5
  111. package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -1
  112. package/themes/original/src/components/PaymentOptions/index.tsx +20 -23
  113. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
  114. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  115. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  116. package/themes/original/src/components/PreviousOrders/index.tsx +4 -0
  117. package/themes/original/src/components/ProductForm/index.tsx +35 -20
  118. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  119. package/themes/original/src/components/ProductOptionSubOption/index.tsx +81 -74
  120. package/themes/original/src/components/ReviewDriver/index.tsx +315 -0
  121. package/themes/original/src/components/ReviewDriver/styles.tsx +38 -0
  122. package/themes/original/src/components/ReviewOrder/index.tsx +307 -186
  123. package/themes/original/src/components/ReviewOrder/styles.tsx +24 -13
  124. package/themes/original/src/components/ReviewProducts/index.tsx +116 -0
  125. package/themes/original/src/components/ReviewProducts/styles.tsx +16 -0
  126. package/themes/original/src/components/SignupForm/index.tsx +173 -154
  127. package/themes/original/src/components/SingleProductCard/index.tsx +6 -13
  128. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -1
  129. package/themes/original/src/components/SingleProductReview/index.tsx +166 -0
  130. package/themes/original/src/components/SingleProductReview/styles.tsx +27 -0
  131. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  132. package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
  133. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  134. package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
  135. package/themes/original/src/components/UserProfile/index.tsx +13 -6
  136. package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
  137. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  138. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  139. package/themes/original/src/layouts/FloatingBottomContainer.tsx +26 -0
  140. package/themes/original/src/types/index.tsx +47 -10
  141. package/themes/single-business/src/components/LastOrder/index.tsx +3 -1
  142. package/themes/single-business/src/components/OrderDetails/index.tsx +15 -0
  143. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
  144. package/themes/single-business/src/components/OrdersOption/index.tsx +4 -2
  145. package/themes/single-business/src/utils/index.tsx +7 -1
  146. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  147. package/themes/uber-eats/src/components/OrderDetails/index.tsx +3 -1
  148. package/themes/uber-eats/src/components/OrdersOption/index.tsx +4 -2
  149. package/src/components/StripeMethodForm/index.tsx +0 -163
@@ -5,7 +5,7 @@ export const StyledContainer = styled.ScrollView`
5
5
  zIndex: 1000;
6
6
  width: 100%;
7
7
  background-color: #fff;
8
- padding: 20px 20px 20px 0px;
8
+ padding: 20px 0 0;
9
9
  bottom: 0;
10
10
  shadow-color: #000;
11
11
  shadow-opacity: 0.4;
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { useLanguage } from 'ordering-components/native';
3
-
3
+ import { useCartBottomSheet } from '../../providers/CartBottomSheetProvider';
4
4
  import { CCNotCarts } from './styles';
5
5
 
6
6
  import { Cart } from '../Cart';
@@ -22,6 +22,7 @@ export const CartContent = (props: any) => {
22
22
 
23
23
  const [, t] = useLanguage()
24
24
  const [isCartsLoading, setIsCartsLoading] = useState(false)
25
+ const [, { hideCartBottomSheet }] = useCartBottomSheet();
25
26
 
26
27
  const cartProps = {
27
28
  navigation,
@@ -33,6 +34,15 @@ export const CartContent = (props: any) => {
33
34
  resetInactivityTimeout,
34
35
  }
35
36
 
37
+ useEffect(() => {
38
+ if (!cart && showNotFound) {
39
+ navigation?.canGoBack()
40
+ ? navigation.goBack()
41
+ : props.onNavigationRedirect && props.onNavigationRedirect('Business')
42
+ hideCartBottomSheet()
43
+ }
44
+ }, [cart])
45
+
36
46
  const content = (
37
47
  <>
38
48
  {(isOrderStateCarts && cart) && (
@@ -46,13 +56,13 @@ export const CartContent = (props: any) => {
46
56
  }
47
57
  </>
48
58
  )}
49
- {(!cart && showNotFound) && (
59
+ {/* {(!cart && showNotFound) && (
50
60
  <CCNotCarts>
51
61
  <OText size={24} style={{ textAlign: 'center' }}>
52
62
  {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
53
63
  </OText>
54
64
  </CCNotCarts>
55
- )}
65
+ )} */}
56
66
  <Spinner visible={isCartsLoading} />
57
67
  </>
58
68
  )
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react';
2
- import { View, Animated, TouchableOpacity } from 'react-native';
2
+ import { View, Animated, TouchableOpacity, ImageBackground } from 'react-native';
3
3
  import { useLanguage, useUtils } from 'ordering-components/native';
4
+ import FastImage from 'react-native-fast-image'
4
5
 
5
6
  import {
6
7
  StyledCartItem,
@@ -70,13 +71,24 @@ const CartItem = (props: CartItemProps) => {
70
71
  >
71
72
  <StyledCartItem>
72
73
  <View style={{ flexDirection: 'row' }}>
73
- <OImage
74
- source={{ uri: product?.images || '' }}
75
- height={60}
76
- width={60}
77
- resizeMode="cover"
78
- borderRadius={6}
79
- />
74
+ {product?.images ? (
75
+ <FastImage
76
+ style={{ height: 60, width: 80, borderRadius: 6 }}
77
+ source={{
78
+ uri: product?.images,
79
+ priority: FastImage.priority.normal,
80
+ // cache:FastImage.cacheControl.web
81
+ }}
82
+ resizeMode={FastImage.resizeMode.cover}
83
+ />
84
+ ) : (
85
+ <ImageBackground
86
+ style={{ height: 60, width: 80, borderRadius: 6 }}
87
+ source={theme.images.dummies.product}
88
+ imageStyle={{ borderRadius: 6 }}
89
+ resizeMode='cover'
90
+ />
91
+ )}
80
92
 
81
93
  <View style={{ flexDirection: 'column', justifyContent: 'space-evenly', marginHorizontal: 15, marginTop: 10 }}>
82
94
  <View>
@@ -156,13 +156,17 @@ const CategoriesMenu = (props: any): React.ReactElement => {
156
156
  <OCard
157
157
  key={product.id}
158
158
  title={product?.name}
159
- image={{ uri: product?.images }}
159
+ isUri={!!product.images}
160
+ image={product.images ? {uri: product.images} : theme.images.dummies.product}
161
+ price={parsePrice(product?.price)}
162
+ description={product?.description}
163
+ prevPrice={product?.offer_price > 0 && parsePrice(product?.offer_price)}
160
164
  style={{
165
+ borderRadius: 10,
161
166
  width: orientationState?.orientation === LANDSCAPE
162
167
  ? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.145 :orientationState?.dimensions?.width * 0.16
163
168
  : orientationState?.dimensions?.width * 0.20
164
169
  }}
165
- titleStyle={{marginTop: Platform.OS === 'ios' ? orientationState?.orientation === LANDSCAPE ? orientationState?.dimensions.height * 0.05 : orientationState?.dimensions.width * 0.05 : 0}}
166
170
  onPress={() => {
167
171
  resetInactivityTimeout()
168
172
  if (isDrawer) {
@@ -176,9 +180,6 @@ const CategoriesMenu = (props: any): React.ReactElement => {
176
180
  });
177
181
  }
178
182
  }}
179
- {...(!!product?.description && { description: product?.description } )}
180
- {...(!!product?.price && { price: parsePrice(product?.price) } )}
181
- {...(product?.in_offer && { prevPrice: `$${product?.offer_price}` } )}
182
183
  />
183
184
  ))}
184
185
  </GridContainer>
@@ -212,6 +213,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
212
213
  businessId={parseInt(businessId, 10)}
213
214
  businessSlug={businessSlug}
214
215
  onSave={() => {
216
+ showCartBottomSheet()
215
217
  setDrawerValues({ isOpen: !drawerState.isOpen, data: null })
216
218
  }}
217
219
  navigation={navigation}
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { useLanguage, ToastType, useToast } from 'ordering-components/native';
3
- import { _setStoreData } from '../../../../../src/providers/StoreUtil';
3
+ import { _setStoreData, _removeStoreData } from '../../../../../src/providers/StoreUtil';
4
4
 
5
5
  import { OButton, OInput, OText } from '../shared';
6
6
  import { useForm, Controller } from 'react-hook-form';
@@ -24,10 +24,15 @@ const CustomerName = (props: Props): React.ReactElement => {
24
24
  const [orientationState] = useDeviceOrientation();
25
25
 
26
26
  const onSubmit = (values: any) => {
27
- _setStoreData('customer_name', { customerName: values.name });
27
+ _setStoreData('customer_name', {customerName: values.name});
28
28
  onProceedToPay()
29
29
  };
30
30
 
31
+ const onSkip = () => {
32
+ _removeStoreData('customer_name')
33
+ onProceedToPay()
34
+ }
35
+
31
36
  const styles = StyleSheet.create({
32
37
  inputStyle: {
33
38
  borderRadius: 4,
@@ -52,30 +57,26 @@ const CustomerName = (props: Props): React.ReactElement => {
52
57
 
53
58
  const goToBack = () => navigation?.goBack();
54
59
 
55
- const submitButton = (
56
- <View style={{ flex: 1, alignItems: 'center' }}>
57
- <OButton
58
- text={t('PROCEED_TO_PAY', 'Proceed to Pay')}
59
- onClick={handleSubmit(onSubmit)}
60
- textStyle={{ color: theme.colors.primaryContrast, fontSize: 20 }}
61
- parentStyle={{
62
- height: orientationState?.orientation === PORTRAIT
63
- ? 50 : 100
64
- }}
65
- style={{
66
- width: orientationState?.orientation === PORTRAIT
67
- ? orientationState?.dimensions.width * 0.5
68
- : orientationState?.dimensions.width * 0.5
69
- }}
70
- />
71
- </View>
72
- );
60
+ const submitButton = (<OButton
61
+ text={t('PROCEED_TO_PAY', 'Proceed to Pay')}
62
+ onClick={handleSubmit(onSubmit)}
63
+ textStyle={{color: theme.colors.primaryContrast, fontSize: 20}}
64
+ parentStyle={{
65
+ height: orientationState?.orientation === PORTRAIT
66
+ ? 50 : 100
67
+ }}
68
+ style={{
69
+ width: orientationState?.orientation === PORTRAIT
70
+ ? orientationState?.dimensions.width - 40
71
+ : orientationState?.dimensions.width * 0.5,
72
+ }}
73
+ />);
73
74
 
74
- const skipButton = (
75
- <View style={{ flex: 1, alignItems: 'center' }}>
75
+ const skipButton = (
76
+ <View style={{flex:1, left: orientationState?.dimensions.width * 0.2,}}>
76
77
  <OButton
77
78
  text={t('SKIP', 'Skip')}
78
- onClick={onProceedToPay}
79
+ onClick={onSkip}
79
80
  textStyle={{ color: theme.colors.primary, fontSize: 20 }}
80
81
  parentStyle={{
81
82
  height: orientationState?.orientation === PORTRAIT
@@ -84,7 +85,7 @@ const CustomerName = (props: Props): React.ReactElement => {
84
85
  style={{
85
86
  backgroundColor: theme.colors.white,
86
87
  width: orientationState?.orientation === PORTRAIT
87
- ? orientationState?.dimensions.width * 0.2
88
+ ? orientationState?.dimensions.width - 40
88
89
  : orientationState?.dimensions.width * 0.1,
89
90
  }}
90
91
  />
@@ -93,78 +94,78 @@ const CustomerName = (props: Props): React.ReactElement => {
93
94
 
94
95
  return (
95
96
  <>
96
- <Container>
97
- <NavBar
98
- title={t('YOUR_NAME', 'Your name')}
99
- onActionLeft={goToBack}
100
- btnStyle={{ paddingLeft: 0 }}
101
- />
102
- <View style={{
103
- marginVertical: orientationState?.dimensions?.height * 0.08,
104
- alignItems: 'center'
105
- }}>
106
- <OText
107
- size={orientationState?.dimensions?.width * 0.05}
108
- style={{ bottom: 20 }}
109
- >
110
- {t('WHATS_YOUR_NAME', "What's your name?")}
111
- {/* <OText
97
+ <Container>
98
+ <NavBar
99
+ title={t('YOUR_NAME', 'Your name')}
100
+ onActionLeft={goToBack}
101
+ btnStyle={{paddingLeft: 0}}
102
+ />
103
+ <View style={{
104
+ marginVertical: orientationState?.dimensions?.height * 0.08,
105
+ paddingLeft: orientationState?.dimensions?.width * 0.25
106
+ }}>
107
+ <OText
108
+ size={orientationState?.dimensions?.width * 0.05}
109
+ style={{bottom: 20}}
110
+ >
111
+ {t('WHATS_YOUR_NAME', "What's your name?")}
112
+ {/* <OText
112
113
  size={orientationState?.dimensions?.width * 0.05}
113
114
  weight={'700'}
114
115
  >
115
116
  {`${t('ORDER_BE_FOR', 'order be for?')}`}
116
117
  </OText> */}
117
- </OText>
118
- <Controller
119
- control={control}
120
- render={({ onChange, value }: any) => (
121
- <OInput
122
- placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
123
- style={{
124
- ...styles.inputStyle,
125
- width: orientationState?.orientation === PORTRAIT
126
- ? orientationState?.dimensions.width * 0.5
127
- : orientationState?.dimensions.width * 0.5,
118
+ </OText>
119
+ <Controller
120
+ control={control}
121
+ render={({ onChange, value }: any) => (
122
+ <OInput
123
+ placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
124
+ style={{
125
+ ...styles.inputStyle,
126
+ width: orientationState?.orientation === PORTRAIT
127
+ ? orientationState?.dimensions.width - 40
128
+ : orientationState?.dimensions.width * 0.5,
129
+ }}
130
+ value={value}
131
+ autoCapitalize="words"
132
+ autoCorrect={false}
133
+ onChange={(val: any) => onChange(val)}
134
+ onSubmitEditing={handleSubmit(onSubmit)}
135
+ />
136
+ )}
137
+ name="name"
138
+ rules={{
139
+ required: t(
140
+ 'VALIDATION_ERROR_REQUIRED',
141
+ 'The field Customer Name is required',
142
+ ).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
143
+ pattern: {
144
+ value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
145
+ message: t(
146
+ 'INVALID_ERROR',
147
+ 'Invalid name',
148
+ ).replace('_attribute_', t('NAME', 'Name')),
149
+ }
128
150
  }}
129
- value={value}
130
- autoCapitalize="words"
131
- autoCorrect={false}
132
- onChange={(val: any) => onChange(val)}
133
- onSubmitEditing={handleSubmit(onSubmit)}
151
+ defaultValue=""
134
152
  />
135
- )}
136
- name="name"
137
- rules={{
138
- required: t(
139
- 'VALIDATION_ERROR_REQUIRED',
140
- 'The field Customer Name is required',
141
- ).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
142
- pattern: {
143
- value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
144
- message: t(
145
- 'INVALID_ERROR',
146
- 'Invalid name',
147
- ).replace('_attribute_', t('NAME', 'Name')),
148
- }
149
- }}
150
- defaultValue=""
151
- />
152
153
 
153
- {orientationState?.orientation === LANDSCAPE && submitButton}
154
- {orientationState?.orientation === LANDSCAPE && skipButton}
155
- {(orientationState?.orientation === PORTRAIT) && (
156
- <OSActions>
157
- {submitButton}
158
- </OSActions>
159
- )}
160
- {(orientationState?.orientation === PORTRAIT) && (
161
- <OSActions>
162
- {skipButton}
163
- </OSActions>
164
- )}
165
- </View>
166
- </Container>
167
- </>
154
+ {orientationState?.orientation === LANDSCAPE && submitButton}
155
+ {orientationState?.orientation === LANDSCAPE && skipButton}
156
+ {(orientationState?.orientation === PORTRAIT) && (
157
+ <OSActions>
158
+ {submitButton}
159
+ </OSActions>
160
+ )}
161
+ {(orientationState?.orientation === PORTRAIT) && (
162
+ <OSActions>
163
+ {skipButton}
164
+ </OSActions>
165
+ )}
166
+ </View>
167
+ </Container>
168
+ </>
168
169
  );
169
170
  };
170
171
 
@@ -32,17 +32,17 @@ const Intro = (props: any): React.ReactElement => {
32
32
  };
33
33
 
34
34
  return (
35
- <ScrollView
36
- scrollEnabled={false}
37
- refreshControl={
38
- <RefreshControl
39
- refreshing={showLogoutPopup ? false : refreshing}
40
- onRefresh={() => setShowLogoutPopup(true)}
41
- />
42
- }
43
- >
35
+ // <ScrollView
36
+ // scrollEnabled={false}
37
+ // refreshControl={
38
+ // <RefreshControl
39
+ // refreshing={showLogoutPopup ? false : refreshing}
40
+ // onRefresh={() => setShowLogoutPopup(true)}
41
+ // />
42
+ // }
43
+ // >
44
44
  <Pressable onPress={goBusiness}>
45
- <Container nopadding={orientationState.orientation === LANDSCAPE}>
45
+ <View style={{ height: orientationState?.dimensions?.height }}>
46
46
  {orientationState.orientation === PORTRAIT ? (
47
47
  <View
48
48
  style={{
@@ -132,15 +132,15 @@ const Intro = (props: any): React.ReactElement => {
132
132
  open={showLogoutPopup}
133
133
  onClose={() => setShowLogoutPopup(false)}
134
134
  />
135
- </Container>
135
+ </View>
136
136
  </Pressable>
137
- </ScrollView>
137
+ // </ScrollView>
138
138
  );
139
139
  };
140
140
 
141
141
  const styles = StyleSheet.create({
142
142
  buttonLandStyle: {
143
- width: 290,
143
+ minWidth: 130,
144
144
  marginBottom: 16
145
145
  }
146
146
  });
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { TouchableOpacity, View, StyleSheet } from 'react-native'
3
- import { LanguageSelector as LanguageSelectorController } from 'ordering-components/native'
2
+ import { TouchableOpacity, View, StyleSheet, ActivityIndicator } from 'react-native'
3
+ import { LanguageSelector as LanguageSelectorController, useOrder } from 'ordering-components/native'
4
4
  import CountryPicker, { Flag } from 'react-native-country-picker-modal'
5
5
 
6
6
  import { Container, LanguageItem } from './styles'
@@ -40,6 +40,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
40
40
  (a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
41
41
  )
42
42
 
43
+ const [orderState] = useOrder()
43
44
  const [isCountryModalVisible, setCountryModalVisible] = useState(false);
44
45
 
45
46
  const countryCodes = _languages?.map((item:any) => item.countryCode);
@@ -48,7 +49,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
48
49
 
49
50
  return (
50
51
  <>
51
- { languagesState.loading ?
52
+ { languagesState.loading ?
52
53
  (<Container>
53
54
  <Placeholder style={{ width: 130, paddingTop: 10 }} Animation={Fade}>
54
55
  <PlaceholderLine height={15}/>
@@ -66,8 +67,8 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
66
67
  closeButtonStyle={styles.closeIcon}
67
68
  renderFlagButton={() => (
68
69
  <TouchableOpacity
69
- onPress={() => setCountryModalVisible(true)}
70
- disabled={languagesState.loading}
70
+ onPress={() => orderState.loading ? {} : setCountryModalVisible(true)}
71
+ // disabled={orderState.loading}
71
72
  >
72
73
  <LanguageItem>
73
74
  <Flag
@@ -76,7 +77,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
76
77
  countryCode={currentLanguageData?.countryCode}
77
78
  />
78
79
  <OText color={theme.colors.primary}>{currentLanguageData?.label}</OText>
79
- <MatarialIcon name='keyboard-arrow-down' size={24}/>
80
+ {orderState.loading ? (
81
+ <ActivityIndicator size="small" color={theme.colors.primary} style={{ marginLeft: 5 }} />
82
+ ) : (
83
+ <MatarialIcon name='keyboard-arrow-down' size={24}/>
84
+ )}
80
85
  </LanguageItem>
81
86
  </TouchableOpacity>
82
87
  )}
@@ -87,11 +92,10 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
87
92
  renderItem: ({item} : any) => (
88
93
  <TouchableOpacity
89
94
  onPress={() => {
90
- /* @ts-ignore */
91
95
  handleChangeLanguage(item.value);
92
96
  setCountryModalVisible(false);
93
97
  }}
94
- disabled={languagesState.loading}
98
+ disabled={orderState.loading}
95
99
  >
96
100
  <LanguageItem>
97
101
  <View style={styles.flagsContainer} />
@@ -5,6 +5,7 @@ import { ImageStyle, TextStyle, View, Platform } from 'react-native'
5
5
  import { OrderTypeSelector } from '../OrderTypeSelector'
6
6
  import { useConfig, useLanguage } from 'ordering-components/native'
7
7
  import { useTheme } from 'styled-components/native'
8
+
8
9
  const Wrapper = styled.View`
9
10
  background-color: ${(props: any) => props.theme.colors.white};
10
11
  padding: 10px 0px 20px 0px;
@@ -64,28 +65,27 @@ const NavBar = (props: Props) => {
64
65
 
65
66
  return (
66
67
  <Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
67
- {(props?.onActionLeft) && (
68
+ {(props?.onActionLeft || props?.leftImg) && (
68
69
  <OButton
69
- imgLeftSrc={props.leftImg}
70
+ imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
70
71
  imgRightSrc={null}
71
72
  style={{ ...btnBackArrow, ...props.btnStyle }}
72
73
  onClick={props.onActionLeft}
73
- imgLeftStyle={props.imgLeftStyle}
74
- {...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
74
+ imgLeftStyle= {props.imgLeftStyle}
75
75
  />)
76
76
  }
77
77
  <TitleTopWrapper>
78
78
  {props.withIcon
79
79
  ? (
80
- <OIcon
81
- url={props.icon}
82
- style={{
83
- borderColor: theme.colors.lightGray,
84
- borderRadius: 20,
85
- }}
86
- width={60}
87
- height={60}
88
- />
80
+ <OIcon
81
+ url={props.icon}
82
+ style={{
83
+ borderColor: theme.colors.lightGray,
84
+ borderRadius: 20,
85
+ }}
86
+ width={60}
87
+ height={60}
88
+ />
89
89
  )
90
90
  : null
91
91
  }
@@ -125,7 +125,7 @@ const NavBar = (props: Props) => {
125
125
  </View>
126
126
  )}
127
127
 
128
- {props.rightComponent}
128
+ { props.rightComponent }
129
129
  </Wrapper>
130
130
  )
131
131
  }
@@ -0,0 +1,60 @@
1
+ import React from 'react'
2
+ import { useLanguage } from 'ordering-components/native'
3
+ import { Dimensions } from 'react-native'
4
+ import RNRestart from 'react-native-restart'
5
+ import { OText, OIcon, OButton } from '../shared'
6
+ import { useTheme } from 'styled-components/native'
7
+ import { NoNetworkParams } from '../../types'
8
+ import {
9
+ Container,
10
+ ImageContainer
11
+ } from './styles'
12
+
13
+ export const NetworkError = (props: NoNetworkParams) => {
14
+ const {
15
+ image
16
+ } = props
17
+ const theme = useTheme()
18
+ const [, t] = useLanguage()
19
+
20
+ const noNetworkImage = image || theme.images.general.noNetwork
21
+ const deviceHeight = Dimensions.get('screen').height
22
+
23
+ return (
24
+ <Container>
25
+ <OText
26
+ size={20}
27
+ weight='700'
28
+ style={{ marginBottom: 14 }}
29
+ >
30
+ {t('MOBILE_NO_INTERNET', 'No internet connection')}
31
+ </OText>
32
+ <OText
33
+ size={14}
34
+ >
35
+ {t('NETWORK_OFFLINE_MESSAGE', 'Your connection appears to be off-line. Try to refresh the page')}
36
+ </OText>
37
+ <ImageContainer>
38
+ <OIcon
39
+ src={noNetworkImage}
40
+ width={(deviceHeight - 180) * 0.7}
41
+ height={(deviceHeight - 180) * 0.63}
42
+ />
43
+ <OButton
44
+ text={t('REFRESH', 'Refresh')}
45
+ bgColor={theme.colors.primary}
46
+ borderColor={theme.colors.primary}
47
+ style={{
48
+ borderRadius: 8,
49
+ marginTop: 45,
50
+ height: 44
51
+ }}
52
+ textStyle={{
53
+ color: theme.colors.white
54
+ }}
55
+ onClick={() => RNRestart.Restart()}
56
+ />
57
+ </ImageContainer>
58
+ </Container>
59
+ )
60
+ }
@@ -0,0 +1,11 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ flex: 1;
5
+ padding: 20px 40px;
6
+ `
7
+ export const ImageContainer = styled.View`
8
+ flex: 1;
9
+ align-items: center;
10
+ justify-content: center;
11
+ `
@@ -95,7 +95,7 @@ interface Props {
95
95
  style?: ViewStyle;
96
96
  bgImage: ImageSourcePropType;
97
97
  innerStyle?: ViewStyle;
98
- icon?: ImageSourcePropType;
98
+ icon: ImageSourcePropType;
99
99
  iconStyle?: ImageStyle;
100
100
  callToActionText: string;
101
101
  callToActionTextStyle?: TextStyle;
@@ -212,7 +212,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
212
212
  setCustomerName(name)
213
213
  } catch (e) {
214
214
  if (e) {
215
- setCustomerName('')
215
+ setCustomerName(null)
216
216
  }
217
217
  }
218
218
  }
@@ -553,7 +553,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
553
553
  size={orientationState?.dimensions?.width * 0.048}
554
554
  weight="700"
555
555
  >
556
- {`${t('HUNGRY', 'hungry')}, ${customerName}`}
556
+ {t('HUNGRY', 'hungry')}{!!customerName && `, ${customerName}`}
557
557
  </OText>
558
558
  </OText>
559
559
 
@@ -169,7 +169,7 @@ const OrderSummaryUI = (props: any) => {
169
169
  isCartProduct
170
170
  productCart={curProduct}
171
171
  businessSlug={cart?.business?.slug}
172
- businessId={curProduct?.business_id}
172
+ businessId={cart?.business_id}
173
173
  categoryId={curProduct?.category_id}
174
174
  productId={curProduct?.id}
175
175
  onSave={handlerProductAction}