ordering-ui-react-native 0.14.41 → 0.14.42-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 (55) hide show
  1. package/package.json +2 -2
  2. package/src/components/BusinessItemAccordion/index.tsx +2 -2
  3. package/src/components/Cart/index.tsx +135 -42
  4. package/src/components/Cart/styles.tsx +7 -0
  5. package/src/components/Checkout/index.tsx +28 -166
  6. package/src/components/OrderDetails/index.tsx +102 -34
  7. package/src/components/OrderDetails/styles.tsx +7 -0
  8. package/src/components/OrderSummary/index.tsx +140 -37
  9. package/src/components/OrderSummary/styles.tsx +10 -2
  10. package/src/components/PaymentOptions/index.tsx +3 -1
  11. package/src/components/PaymentOptionsWebView/index.tsx +150 -0
  12. package/src/components/ProductForm/index.tsx +6 -6
  13. package/src/components/SingleProductCard/index.tsx +1 -1
  14. package/src/components/StripeElementsForm/index.tsx +28 -13
  15. package/src/components/TaxInformation/index.tsx +58 -26
  16. package/src/components/VerifyPhone/styles.tsx +1 -2
  17. package/src/components/shared/OIcon.tsx +4 -1
  18. package/src/index.tsx +2 -0
  19. package/src/navigators/HomeNavigator.tsx +6 -0
  20. package/src/pages/ProductDetails.tsx +55 -0
  21. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  22. package/themes/kiosk/src/components/Cart/index.tsx +14 -21
  23. package/themes/kiosk/src/components/CartItem/index.tsx +9 -7
  24. package/themes/kiosk/src/components/CustomerName/index.tsx +2 -1
  25. package/themes/kiosk/src/components/Intro/index.tsx +4 -4
  26. package/themes/kiosk/src/components/OptionCard/index.tsx +11 -6
  27. package/themes/kiosk/src/components/PaymentOptions/index.tsx +46 -44
  28. package/themes/original/src/components/BusinessController/index.tsx +3 -3
  29. package/themes/original/src/components/BusinessFeaturedController/index.tsx +2 -2
  30. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  31. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -2
  32. package/themes/original/src/components/BusinessProductsListing/index.tsx +8 -4
  33. package/themes/original/src/components/BusinessesListing/index.tsx +129 -94
  34. package/themes/original/src/components/Cart/index.tsx +122 -24
  35. package/themes/original/src/components/Cart/styles.tsx +8 -1
  36. package/themes/original/src/components/Checkout/index.tsx +37 -3
  37. package/themes/original/src/components/Help/index.tsx +1 -1
  38. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -0
  39. package/themes/original/src/components/MessageListing/index.tsx +4 -2
  40. package/themes/original/src/components/MomentOption/index.tsx +150 -158
  41. package/themes/original/src/components/OrderDetails/index.tsx +114 -42
  42. package/themes/original/src/components/OrderDetails/styles.tsx +8 -1
  43. package/themes/original/src/components/OrderProgress/index.tsx +2 -1
  44. package/themes/original/src/components/OrderSummary/index.tsx +132 -23
  45. package/themes/original/src/components/OrderSummary/styles.tsx +7 -0
  46. package/themes/original/src/components/PaymentOptions/index.tsx +8 -2
  47. package/themes/original/src/components/ProductForm/index.tsx +63 -56
  48. package/themes/original/src/components/ProductOptionSubOption/index.tsx +54 -51
  49. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +8 -1
  50. package/themes/original/src/components/SingleProductCard/index.tsx +36 -19
  51. package/themes/original/src/components/SingleProductCard/styles.tsx +4 -0
  52. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -13
  53. package/themes/original/src/components/TaxInformation/index.tsx +59 -27
  54. package/themes/original/src/components/UpsellingProducts/index.tsx +26 -18
  55. package/themes/original/src/types/index.tsx +2 -0
@@ -72,12 +72,13 @@ const CustomerName = (props: Props): React.ReactElement => {
72
72
  <OButton
73
73
  text={t('SKIP', 'Skip')}
74
74
  onClick={onProceedToPay}
75
- textStyle={{color: theme.colors.primaryContrast, fontSize: 20}}
75
+ textStyle={{color: theme.colors.primary, fontSize: 20}}
76
76
  parentStyle={{
77
77
  height: orientationState?.orientation === PORTRAIT
78
78
  ? 50 : 100
79
79
  }}
80
80
  style={{
81
+ backgroundColor: theme.colors.white,
81
82
  width: orientationState?.orientation === PORTRAIT
82
83
  ? orientationState?.dimensions.width - 40
83
84
  : orientationState?.dimensions.width * 0.1,
@@ -8,7 +8,7 @@ import OImage from '../../components/shared/OImage';
8
8
  import OButton from '../../components/shared/OButton';
9
9
  import { LanguageSelector } from '../../components/LanguageSelector';
10
10
  import { LogoutPopup } from '../../components/LogoutPopup';
11
- import {PORTRAIT, LANDSCAPE, useDeviceOrientation} from "../../../../../src/hooks/DeviceOrientation";
11
+ import { PORTRAIT, LANDSCAPE, useDeviceOrientation } from "../../../../../src/hooks/DeviceOrientation";
12
12
 
13
13
  const Intro = (props: any): React.ReactElement => {
14
14
  const { navigation } = props;
@@ -87,7 +87,7 @@ const Intro = (props: any): React.ReactElement => {
87
87
  source={theme.images.general.homeHeroLandscape}
88
88
  width={orientationState?.dimensions?.width * 0.40}
89
89
  height={orientationState?.dimensions?.height * 1.1}
90
- style={{bottom: 100, right: 100}}
90
+ style={{ bottom: 100, right: 100 }}
91
91
  resizeMode='cover'
92
92
  />
93
93
 
@@ -114,7 +114,7 @@ const Intro = (props: any): React.ReactElement => {
114
114
 
115
115
  <OButton
116
116
  style={styles.buttonLandStyle}
117
- text={t('TOUCH_TO_ORDER', 'Touch to order')}
117
+ text={t('TOUCH_ANYWHERE_TO_ORDER', 'Touch anywhere to order')}
118
118
  parentStyle={{
119
119
  alignItems: 'center',
120
120
  width: orientationState?.dimensions?.width - _offset
@@ -138,7 +138,7 @@ const Intro = (props: any): React.ReactElement => {
138
138
 
139
139
  const styles = StyleSheet.create({
140
140
  buttonLandStyle: {
141
- width: 260,
141
+ width: 290,
142
142
  marginBottom: 16
143
143
  }
144
144
  });
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { FunctionComponent } from 'react';
2
2
  import { ImageSourcePropType, ImageStyle, TextStyle, ViewStyle, ActivityIndicator } from 'react-native';
3
3
  import { TouchableOpacity } from 'react-native-gesture-handler';
4
4
  import { useTheme } from 'styled-components/native';
@@ -28,11 +28,15 @@ const OptionCard = (props: Props) => {
28
28
  <ActivityIndicator size='large' color='#ffffff' />
29
29
  </ActivityIndicatorContainer>
30
30
  )}
31
- <OIcon
32
- src={props.icon}
33
- style={{ marginBottom: 10, ...props?.iconStyle }}
34
- />
35
-
31
+ {props.icon && (
32
+ <OIcon
33
+ src={props.icon}
34
+ style={{ marginBottom: 10, ...props?.iconStyle }}
35
+ />
36
+ )}
37
+ {props.VectorIcon && (
38
+ <props.VectorIcon />
39
+ )}
36
40
  <OText
37
41
  weight="700"
38
42
  color="white"
@@ -97,6 +101,7 @@ interface Props {
97
101
  callToActionTextStyle?: TextStyle;
98
102
  callToActionIcon?: ImageSourcePropType;
99
103
  callToActionIconStyle?: ImageStyle;
104
+ VectorIcon?: FunctionComponent;
100
105
  }
101
106
 
102
107
  export default OptionCard;
@@ -19,6 +19,8 @@ import Spinner from 'react-native-loading-spinner-overlay';
19
19
  import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
20
20
  import GridContainer from '../../layouts/GridContainer';
21
21
  import { OModal, PaymentOptionStripe } from '../../../../../src';
22
+ import AntIconDesign from 'react-native-vector-icons/AntDesign'
23
+ import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
22
24
 
23
25
  const PaymentOptionsUI = (props: any) => {
24
26
  const {
@@ -41,7 +43,7 @@ const PaymentOptionsUI = (props: any) => {
41
43
  } = props;
42
44
 
43
45
  const theme = useTheme();
44
- const [, {showToast}] = useToast();
46
+ const [, { showToast }] = useToast();
45
47
  const [, t] = useLanguage();
46
48
  const [orientationState] = useDeviceOrientation();
47
49
  const [userErrors, setUserErrors] = useState<any>([]);
@@ -134,52 +136,52 @@ const PaymentOptionsUI = (props: any) => {
134
136
  CASH_ID:
135
137
  cashIndex !== -1
136
138
  ? {
137
- style: cardStyle,
138
- title: t('CASH', 'Cash'),
139
- description: t(
140
- 'GO_FOR_YOR_RECEIPT_AND_GO_TO_THE_FRONT_COUNTER',
141
- 'Pay with cash in the front counter',
142
- ),
143
- bgImage: theme.images.general.cash,
144
- icon: theme.images.general.shoppingCart,
145
- callToActionText: t('LETS_GO', 'LETS_GO'),
146
- onClick: () =>
147
- onSelectPaymethod(supportedMethods[cashIndex], false),
148
- ...supportedMethods[cashIndex],
149
- }
139
+ style: cardStyle,
140
+ title: t('CASH', 'Cash'),
141
+ description: t(
142
+ 'GO_FOR_YOR_RECEIPT_AND_GO_TO_THE_FRONT_COUNTER',
143
+ 'Pay with cash in the front counter',
144
+ ),
145
+ bgImage: theme.images.general.cash,
146
+ callToActionText: t('LETS_GO', 'LETS_GO'),
147
+ VectorIcon: () => <AntIconDesign name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />,
148
+ onClick: () =>
149
+ onSelectPaymethod(supportedMethods[cashIndex], false),
150
+ ...supportedMethods[cashIndex],
151
+ }
150
152
  : null,
151
153
 
152
154
  CARD_ON_DELIVERY_ID:
153
155
  cardOnDeliveryIndex !== -1
154
156
  ? {
155
- style: cardStyle,
156
- title: t('CARD', supportedMethods[cardOnDeliveryIndex]?.name),
157
- description: t(
158
- 'WE_ACCEPT_EVERY_DEBIT_OR_CREDIT_CARD',
159
- 'We accept every debit or credit card',
160
- ),
161
- bgImage: theme.images.general.carddelivery,
162
- icon: theme.images.general.pushPin,
163
- callToActionText: t("LETS_GO", "Let's go"),
164
- onClick: () => onSelectPaymethod(supportedMethods[cardOnDeliveryIndex], false),
165
- ...supportedMethods[cardOnDeliveryIndex],
166
- }
157
+ style: cardStyle,
158
+ title: t('CARD', supportedMethods[cardOnDeliveryIndex]?.name),
159
+ description: t(
160
+ 'WE_ACCEPT_EVERY_DEBIT_OR_CREDIT_CARD',
161
+ 'We accept every debit or credit card',
162
+ ),
163
+ bgImage: theme.images.general.carddelivery,
164
+ callToActionText: t("LETS_GO", "Let's go"),
165
+ VectorIcon: () => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />,
166
+ onClick: () => onSelectPaymethod(supportedMethods[cardOnDeliveryIndex], false),
167
+ ...supportedMethods[cardOnDeliveryIndex],
168
+ }
167
169
  : null,
168
170
  STRIPE:
169
171
  stripeIndex !== -1
170
172
  ? {
171
- style: cardStyle,
172
- title: t('STRIPE', supportedMethods[stripeIndex]?.name),
173
- description: t('STRIPE', 'Stripe'),
174
- bgImage: theme.images.general.carddelivery,
175
- icon: theme.images.general.pushPin,
176
- callToActionText: t('INSERT_INFO', 'Test info'),
177
- onClick: () => {
178
- onSelectPaymethod(supportedMethods[stripeIndex], false);
179
- setIsOpenModal(true)
180
- },
181
- ...supportedMethods[stripeIndex],
182
- }
173
+ style: cardStyle,
174
+ title: t('STRIPE', supportedMethods[stripeIndex]?.name),
175
+ description: t('STRIPE', 'Stripe'),
176
+ bgImage: theme.images.general.carddelivery,
177
+ callToActionText: t('INSERT_INFO', 'Test info'),
178
+ VectorIcon: () => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />,
179
+ onClick: () => {
180
+ onSelectPaymethod(supportedMethods[stripeIndex], false);
181
+ setIsOpenModal(true)
182
+ },
183
+ ...supportedMethods[stripeIndex],
184
+ }
183
185
  : null,
184
186
  };
185
187
 
@@ -193,11 +195,11 @@ const PaymentOptionsUI = (props: any) => {
193
195
  <NavBar
194
196
  title={t('PAYMENT_METHODS', 'Payment methods')}
195
197
  onActionLeft={goToBack}
196
- btnStyle={{paddingLeft: 0}}
198
+ btnStyle={{ paddingLeft: 0 }}
197
199
  />
198
200
 
199
201
  <View
200
- style={{marginVertical: orientationState?.dimensions?.height * 0.03}}>
202
+ style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
201
203
  <OText size={orientationState?.dimensions?.width * 0.048}>
202
204
  {t('HOW_WOULD_YOU', 'How would you')} {'\n'}
203
205
  <OText
@@ -209,10 +211,10 @@ const PaymentOptionsUI = (props: any) => {
209
211
  </View>
210
212
 
211
213
  {supportedMethods?.length > 0 && (
212
- <GridContainer style={{justifyContent: 'space-between'}}>
214
+ <GridContainer style={{ justifyContent: 'space-between' }}>
213
215
  {propsOfItems.CARD_ON_DELIVERY_ID && (
214
- <View style={{marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0}}>
215
- <OptionCard {...propsOfItems?.CARD_ON_DELIVERY_ID} styke/>
216
+ <View style={{ marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0 }}>
217
+ <OptionCard {...propsOfItems?.CARD_ON_DELIVERY_ID} styke />
216
218
  </View>
217
219
  )}
218
220
 
@@ -249,7 +251,7 @@ const PaymentOptionsUI = (props: any) => {
249
251
  )}
250
252
  </GridContainer>
251
253
  )}
252
- <View style={{height: orientationState?.dimensions?.height * 0.05}} />
254
+ <View style={{ height: orientationState?.dimensions?.height * 0.05 }} />
253
255
  <OModal
254
256
  open={isOpenModal}
255
257
  onClose={() => setIsOpenModal(false)}
@@ -25,7 +25,7 @@ import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
25
25
  import FastImage from 'react-native-fast-image'
26
26
 
27
27
  export const BusinessControllerUI = (props: BusinessControllerParams) => {
28
- const { business, handleClick, navigation } = props;
28
+ const { business, handleClick, navigation, isBusinessOpen } = props;
29
29
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] =
30
30
  useUtils();
31
31
  const [orderState] = useOrder();
@@ -122,7 +122,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
122
122
  </View>
123
123
  )}
124
124
  <BusinessState>
125
- {!business?.open && (
125
+ {!isBusinessOpen && (
126
126
  <View style={styles.businessStateView}>
127
127
  <OText
128
128
  color={theme.colors.textThird}
@@ -168,7 +168,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
168
168
  <OText>{getBusinessType()}</OText>
169
169
  </BusinessCategory> */}
170
170
  <Metadata>
171
- {!business?.open ? (
171
+ {!isBusinessOpen ? (
172
172
  <View style={styles.closed}>
173
173
  <OText size={10} color={theme.colors.red}>
174
174
  {t('CLOSED', 'Closed')}
@@ -23,7 +23,7 @@ import {
23
23
  } from './styles';
24
24
 
25
25
  export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
26
- const { business, handleClick } = props;
26
+ const { business, handleClick, isBusinessOpen } = props;
27
27
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] =
28
28
  useUtils();
29
29
  const [orderState] = useOrder();
@@ -128,7 +128,7 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
128
128
  <OText>{getBusinessType()}</OText>
129
129
  </BusinessCategory> */}
130
130
  <Metadata>
131
- {!business?.open ? (
131
+ {!isBusinessOpen ? (
132
132
  <View style={styles.closed}>
133
133
  <OText size={10} color={theme.colors.red}>
134
134
  {t('CLOSED', 'Closed')}
@@ -139,17 +139,20 @@ export const BusinessItemAccordion = (props: any) => {
139
139
  )}
140
140
  </BIActions>
141
141
  </BIHeader>
142
- {!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled && (
142
+ {!isActive && !isClosed && !!isProducts && (
143
143
  <PriceContainer>
144
144
  <OText>{parsePrice(cart?.total)}</OText>
145
- <OButton
146
- onClick={handleClickCheckout}
147
- textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
148
- style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
149
- text={t('CHECKOUT', 'Checkout')}
150
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
151
- borderColor={theme.colors.primary}
152
- />
145
+ {cart?.valid_products && (
146
+ <OButton
147
+ onClick={handleClickCheckout}
148
+ textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
149
+ style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
150
+ text={t('CHECKOUT', 'Checkout')}
151
+ bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
152
+ borderColor={theme.colors.primary}
153
+ isDisabled={checkoutButtonDisabled}
154
+ />
155
+ )}
153
156
  </PriceContainer>
154
157
  )}
155
158
 
@@ -7,9 +7,10 @@ export const BIContainer = styled.View`
7
7
  opacity: 1;
8
8
  border-radius: 7.6px;
9
9
  overflow: hidden;
10
-
10
+ min-height: 120px;
11
11
  ${(props: any) => props.isClosed && css`
12
- opacity: 0.5;
12
+ opacity: 0.5;
13
+ min-height: 60px;
13
14
  `}
14
15
  `
15
16
 
@@ -155,6 +155,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
155
155
  const handleTouchDrag = useCallback(() => {
156
156
  setCategoryClicked(false);
157
157
  }, []);
158
+
159
+ const handleBackNavigation = () => {
160
+ navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
161
+ }
158
162
 
159
163
  return (
160
164
  <SafeAreaView
@@ -169,7 +173,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
169
173
  imgLeftSrc={theme.images.general.arrow_left}
170
174
  imgRightSrc={null}
171
175
  style={styles.btnBackArrow}
172
- onClick={() => navigation?.canGoBack() && navigation.goBack()}
176
+ onClick={() => handleBackNavigation()}
173
177
  imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
174
178
  />
175
179
  </View>
@@ -231,7 +235,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
231
235
  selectedCategoryId={selectedCategoryId}
232
236
  lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
233
237
  setSelectedCategoryId={setSelectedCategoryId}
234
- setCategoryClicked={setCategoryClicked}
238
+ setCategoryClicked={setCategoryClicked}
235
239
  />
236
240
  )}
237
241
  </>
@@ -309,13 +313,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
309
313
  business={currentCart?.business}
310
314
  cartProducts={currentCart?.products}
311
315
  cart={currentCart}
312
- setOpenUpselling={setOpenUpselling}
316
+ setOpenUpselling={setOpenUpselling}
313
317
  handleUpsellingPage={handleUpsellingPage}
314
318
  handleCloseUpsellingPage={handleCloseUpsellingPage}
315
319
  openUpselling={openUpselling}
316
320
  canOpenUpselling={canOpenUpselling}
317
321
  setCanOpenUpselling={setCanOpenUpselling}
318
- onRedirect={onRedirect}
322
+ onRedirect={onRedirect}
319
323
  />
320
324
  )}
321
325
  </SafeAreaView>