ordering-ui-react-native 0.15.30 → 0.15.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 (170) hide show
  1. package/package.json +4 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessController/index.tsx +8 -2
  4. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +23 -3
  7. package/src/components/DriverTips/index.tsx +11 -6
  8. package/src/components/LanguageSelector/index.tsx +7 -2
  9. package/src/components/LoginForm/index.tsx +3 -1
  10. package/src/components/OrderDetails/index.tsx +2 -2
  11. package/src/components/PaymentOptions/index.tsx +9 -16
  12. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  13. package/src/components/SignupForm/index.tsx +3 -1
  14. package/src/components/SingleProductCard/index.tsx +16 -4
  15. package/src/components/StripeElementsForm/index.tsx +27 -48
  16. package/src/components/UpsellingProducts/index.tsx +1 -1
  17. package/src/components/UserProfileForm/index.tsx +63 -6
  18. package/src/components/UserProfileForm/styles.tsx +8 -0
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/components/shared/OModal.tsx +1 -1
  21. package/src/config.json +0 -2
  22. package/src/hooks/useCountdownTimer.tsx +26 -0
  23. package/src/navigators/HomeNavigator.tsx +6 -0
  24. package/src/pages/BusinessProductsList.tsx +1 -0
  25. package/src/pages/BusinessesListing.tsx +1 -1
  26. package/src/pages/Checkout.tsx +1 -1
  27. package/src/pages/Sessions.tsx +22 -0
  28. package/src/types/index.tsx +5 -11
  29. package/src/utils/index.tsx +68 -1
  30. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  31. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  32. package/themes/business/src/components/Chat/index.tsx +38 -86
  33. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  34. package/themes/business/src/components/Home/index.tsx +128 -55
  35. package/themes/business/src/components/Home/styles.tsx +8 -1
  36. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  37. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  38. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  39. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  40. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  41. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  42. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  43. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  44. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  45. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  46. package/themes/business/src/components/OrdersOption/index.tsx +58 -51
  47. package/themes/business/src/components/PreviousOrders/index.tsx +58 -17
  48. package/themes/business/src/components/shared/OModal.tsx +1 -1
  49. package/themes/business/src/types/index.tsx +5 -1
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  54. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  55. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  56. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  57. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  58. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  59. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  60. package/themes/kiosk/src/components/CustomerName/index.tsx +7 -8
  61. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  62. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  63. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderDetails/index.tsx +167 -67
  65. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  66. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  67. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  68. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  69. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  70. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  71. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  72. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  73. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  74. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  75. package/themes/kiosk/src/types/index.d.ts +2 -0
  76. package/themes/original/index.tsx +178 -1
  77. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  78. package/themes/original/src/components/AddressList/index.tsx +56 -18
  79. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  80. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  81. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  82. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  83. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  84. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  85. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  86. package/themes/original/src/components/BusinessListingSearch/index.tsx +121 -7
  87. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  88. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  89. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  90. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  91. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  92. package/themes/original/src/components/BusinessProductsList/index.tsx +140 -37
  93. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  94. package/themes/original/src/components/BusinessProductsListing/index.tsx +108 -14
  95. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  96. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  97. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  98. package/themes/original/src/components/BusinessesListing/index.tsx +74 -70
  99. package/themes/original/src/components/Cart/index.tsx +21 -17
  100. package/themes/original/src/components/CartContent/index.tsx +2 -2
  101. package/themes/original/src/components/Checkout/index.tsx +59 -48
  102. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  103. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  104. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  105. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  106. package/themes/original/src/components/Help/index.tsx +21 -4
  107. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  108. package/themes/original/src/components/Home/index.tsx +1 -1
  109. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  110. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  111. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  112. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  113. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  114. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  115. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  116. package/themes/original/src/components/Messages/index.tsx +34 -25
  117. package/themes/original/src/components/Messages/styles.tsx +1 -3
  118. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  119. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  120. package/themes/original/src/components/OrderDetails/index.tsx +56 -33
  121. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  122. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  123. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  124. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  125. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  126. package/themes/original/src/components/OrdersOption/index.tsx +55 -58
  127. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  128. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  129. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  130. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  131. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  132. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  133. package/themes/original/src/components/PreviousOrders/index.tsx +16 -14
  134. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  135. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  136. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  137. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  138. package/themes/original/src/components/Promotions/index.tsx +250 -0
  139. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  140. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  141. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  142. package/themes/original/src/components/SearchBar/index.tsx +4 -1
  143. package/themes/original/src/components/Sessions/index.tsx +160 -0
  144. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  145. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  146. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  147. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  148. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -74
  149. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  150. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  151. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  152. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  153. package/themes/original/src/components/UserProfile/index.tsx +62 -14
  154. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  155. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  156. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  157. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  158. package/themes/original/src/components/Wallets/index.tsx +76 -9
  159. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  160. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  161. package/themes/original/src/components/shared/OModal.tsx +4 -2
  162. package/themes/original/src/components/shared/index.tsx +2 -0
  163. package/themes/original/src/config/constants.tsx +6 -6
  164. package/themes/original/src/types/index.tsx +68 -6
  165. package/themes/original/src/utils/index.tsx +28 -2
  166. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  167. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  168. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  169. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  170. package/src/components/StripeMethodForm/index.tsx +0 -174
@@ -0,0 +1,15 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const SessionsWrapper = styled.View`
4
+ `
5
+ export const SessionItem = styled.View`
6
+ flex-direction: row;
7
+ align-items: center;
8
+ justify-content: space-between;
9
+ padding-vertical: 15px;
10
+ border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
11
+ border-bottom-width: 1px;
12
+ `
13
+ export const DurationWrapper = styled.View`
14
+ /* flex-direction: row; */
15
+ `
@@ -126,7 +126,10 @@ const SignupFormUI = (props: SignupParams) => {
126
126
  const phoneRef = useRef<any>(null);
127
127
  const passwordRef = useRef<any>(null);
128
128
 
129
- const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
129
+ const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
130
+ const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
131
+ const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
132
+ const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
130
133
 
131
134
  const handleRefs = (ref: any, code: string) => {
132
135
  switch (code) {
@@ -684,7 +687,9 @@ const SignupFormUI = (props: SignupParams) => {
684
687
  <ButtonsWrapper>
685
688
  <SocialButtons>
686
689
  {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
687
- configs?.facebook_id?.value && (
690
+ configs?.facebook_id?.value &&
691
+ facebookLoginEnabled &&
692
+ (
688
693
  <FacebookLogin
689
694
  notificationState={notificationState}
690
695
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
@@ -692,7 +697,7 @@ const SignupFormUI = (props: SignupParams) => {
692
697
  handleSuccessFacebookLogin={handleSuccessFacebook}
693
698
  />
694
699
  )}
695
- {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
700
+ {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
696
701
  <GoogleLogin
697
702
  notificationState={notificationState}
698
703
  webClientId={configs?.google_login_client_id?.value}
@@ -701,7 +706,7 @@ const SignupFormUI = (props: SignupParams) => {
701
706
  handleSuccessGoogleLogin={handleSuccessFacebook}
702
707
  />
703
708
  )}
704
- {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
709
+ {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
705
710
  <AppleLogin
706
711
  notificationState={notificationState}
707
712
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
@@ -7,14 +7,20 @@ import {
7
7
  } from 'ordering-components/native';
8
8
  import { useTheme } from 'styled-components/native';
9
9
  import { SingleProductCardParams } from '../../types';
10
- import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer } from './styles';
10
+ import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
11
11
  import { StyleSheet } from 'react-native';
12
12
  import { OText, OIcon } from '../shared';
13
13
  import FastImage from 'react-native-fast-image'
14
+ import { shape } from '../../utils';
14
15
 
15
- export const SingleProductCard = (props: SingleProductCardParams) => {
16
+ function SingleProductCardPropsAreEqual(prevProps : any, nextProps : any) {
17
+ return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
18
+ prevProps.isSoldOut === nextProps.isSoldOut &&
19
+ prevProps.productAddedToCartLength === nextProps.productAddedToCartLength
20
+ }
21
+
22
+ export const SingleProductCard = React.memo((props: SingleProductCardParams) => {
16
23
  const {
17
- businessId,
18
24
  product,
19
25
  isSoldOut,
20
26
  onProductClick,
@@ -46,8 +52,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
46
52
  productStyle: {
47
53
  width: 75,
48
54
  height: 75,
49
- borderRadius: 7.6,
50
- marginStart: 12
55
+ borderRadius: 7.6
51
56
  },
52
57
  quantityContainer: {
53
58
  position: 'absolute',
@@ -136,21 +141,42 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
136
141
  {product?.description}
137
142
  </OText>
138
143
  </CardInfo>
139
- {product?.images ? (
140
- <FastImage
141
- style={styles.productStyle}
142
- source={{
143
- uri: optimizeImage(product?.images, 'h_250,c_limit'),
144
- priority: FastImage.priority.normal,
145
- }}
146
- resizeMode={FastImage.resizeMode.cover}
147
- />
148
- ) : (
149
- <OIcon
150
- src={theme?.images?.dummies?.product}
151
- style={styles.productStyle}
152
- />
153
- )}
144
+ <LogoWrapper>
145
+ {product?.ribbon?.enabled && (
146
+ <RibbonBox
147
+ bgColor={product?.ribbon?.color}
148
+ isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
149
+ isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
150
+ >
151
+ <OText
152
+ size={10}
153
+ weight={'400'}
154
+ color={theme.colors.white}
155
+ numberOfLines={2}
156
+ ellipsizeMode='tail'
157
+ lineHeight={13}
158
+ >
159
+ {product?.ribbon?.text}
160
+ </OText>
161
+ </RibbonBox>
162
+ )}
163
+ {product?.images ? (
164
+ <FastImage
165
+ style={styles.productStyle}
166
+ source={{
167
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
168
+ priority: FastImage.priority.normal,
169
+ }}
170
+ resizeMode={FastImage.resizeMode.cover}
171
+ />
172
+ ) : (
173
+ <OIcon
174
+ src={theme?.images?.dummies?.product}
175
+ style={styles.productStyle}
176
+ />
177
+ )}
178
+ </LogoWrapper>
179
+
154
180
  {(isSoldOut || maxProductQuantity <= 0) && (
155
181
  <SoldOut>
156
182
  <OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
@@ -160,4 +186,4 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
160
186
  )}
161
187
  </CardContainer>
162
188
  );
163
- };
189
+ }, SingleProductCardPropsAreEqual);
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components/native'
1
+ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const CardContainer = styled.TouchableOpacity`
4
4
  flex: 1;
@@ -31,3 +31,30 @@ export const PricesContainer = styled.View`
31
31
  flex-direction: row;
32
32
  align-items: center;
33
33
  `
34
+
35
+ export const LogoWrapper = styled.View`
36
+ position: relative;
37
+ margin-left: 12px;
38
+ `
39
+
40
+ export const RibbonBox = styled.View`
41
+ position: absolute;
42
+ z-index: 1;
43
+ top: -4px;
44
+ right: -4px;
45
+ background-color: ${(props: any) => props.theme.colors.primary};
46
+ padding: 1px 8px;
47
+ max-width: 60px;
48
+
49
+ ${(props: any) => props.bgColor && css`
50
+ background-color: ${props.bgColor};
51
+ `}
52
+
53
+ ${(props: any) => props.isRoundRect && css`
54
+ border-radius: 7.6px;
55
+ `}
56
+
57
+ ${(props: any) => props.isCapsule && css`
58
+ border-radius: 50px;
59
+ `}
60
+ `
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { View, StyleSheet, useWindowDimensions, Keyboard } from 'react-native';
3
- import { useLanguage, useSession, useConfig } from 'ordering-components/native';
3
+ import { useLanguage, useSession } from 'ordering-components/native';
4
4
  import {
5
5
  StripeProvider,
6
6
  CardField,
@@ -13,7 +13,6 @@ import { ErrorMessage } from './styles';
13
13
  import { StripeElementsForm as StripeFormController } from './naked';
14
14
  import { OButton, OText } from '../shared';
15
15
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
16
- import { StripeMethodForm } from '../../../../../src/components/StripeMethodForm';
17
16
 
18
17
  const StripeElementsFormUI = (props: any) => {
19
18
  const {
@@ -23,18 +22,12 @@ const StripeElementsFormUI = (props: any) => {
23
22
  businessId,
24
23
  requirements,
25
24
  stripeTokenHandler,
26
- methodsPay,
27
- paymethod,
28
- onCancel,
29
- cart,
30
- merchantId
31
25
  } = props;
32
26
 
33
27
  const theme = useTheme();
34
28
 
35
29
  const [, t] = useLanguage();
36
30
  const [{ user }] = useSession();
37
- const [{ configs }] = useConfig();
38
31
  const [card, setCard] = useState<any>(null);
39
32
  const [isCompleted, setIsCompleted] = useState(false);
40
33
  const [errors, setErrors] = useState('')
@@ -44,30 +37,30 @@ const StripeElementsFormUI = (props: any) => {
44
37
  const { top, bottom } = useSafeAreaInsets();
45
38
  const [isKeyboardShow, setIsKeyboardShow] = useState(false);
46
39
 
47
- let billingDetails: any = {}
40
+ let billingDetails: any = {}
48
41
 
49
- if (user?.name || user?.lastname) {
50
- if (user?.name) {
51
- billingDetails.name = user?.name
52
- }
53
- if (user?.lastname) {
54
- billingDetails.name = `${billingDetails?.name} ${user?.lastname}`
55
- }
56
- }
42
+ if (user?.name || user?.lastname) {
43
+ if (user?.name) {
44
+ billingDetails.name = user?.name
45
+ }
46
+ if (user?.lastname) {
47
+ billingDetails.name = `${billingDetails?.name} ${user?.lastname}`
48
+ }
49
+ }
57
50
 
58
- if (user?.email) {
59
- billingDetails.email = user?.email
60
- }
51
+ if (user?.email) {
52
+ billingDetails.email = user?.email
53
+ }
61
54
 
62
- if (user?.address) {
63
- billingDetails.addressLine1 = user?.address
64
- }
55
+ if (user?.address) {
56
+ billingDetails.addressLine1 = user?.address
57
+ }
65
58
 
66
59
  const createPayMethod = async () => {
67
- const params: any = { type: 'Card' }
68
- if (Object.keys(billingDetails).length > 0) {
69
- params.billingDetails = billingDetails
70
- }
60
+ const params: any = { type: 'Card' }
61
+ if (Object.keys(billingDetails).length > 0) {
62
+ params.billingDetails = billingDetails
63
+ }
71
64
  try {
72
65
  setCreatePmLoading(true)
73
66
  const { paymentMethod } = await createPaymentMethod(params);
@@ -100,10 +93,10 @@ const StripeElementsFormUI = (props: any) => {
100
93
  createPayMethod();
101
94
  return
102
95
  }
103
- const params: any = { type: 'Card' }
104
- if (Object.keys(billingDetails).length > 0) {
105
- params.billingDetails = billingDetails
106
- }
96
+ const params: any = { type: 'Card' }
97
+ if (Object.keys(billingDetails).length > 0) {
98
+ params.billingDetails = billingDetails
99
+ }
107
100
  try {
108
101
  const { setupIntent, error } = await confirmSetupIntent(requirements, params);
109
102
 
@@ -159,36 +152,27 @@ const StripeElementsFormUI = (props: any) => {
159
152
  <View style={{ ...styles.container, height: height - top - bottom - 60 - (isKeyboardShow ? 250 : 0) }}>
160
153
  {publicKey ? (
161
154
  <View style={{ flex: 1 }}>
162
- <StripeProvider
163
- publishableKey={publicKey}
164
- merchantIdentifier={`merchant.${merchantId}`}
165
- urlScheme={merchantId}
166
- >
167
- {methodsPay?.includes(paymethod) ? (
168
- <StripeMethodForm
169
- handleSource={handleSource}
170
- onCancel={onCancel}
171
- cart={cart}
172
- setErrors={setErrors}
173
- paymethod={paymethod}
174
- devMode={publicKey?.includes('test')}
175
- />
176
- ) : (
177
- <CardField
178
- postalCodeEnabled={true}
179
- cardStyle={{
180
- backgroundColor: '#FFFFFF',
181
- textColor: '#000000',
182
- }}
183
- style={{
184
- width: '100%',
185
- height: 50,
186
- marginVertical: 30,
187
- zIndex: 9999,
188
- }}
189
- onCardChange={(cardDetails: any) => setCard(cardDetails)}
190
- />
191
- )}
155
+ <StripeProvider publishableKey={publicKey}>
156
+ <CardField
157
+ postalCodeEnabled={false}
158
+ cardStyle={{
159
+ backgroundColor: '#FFFFFF',
160
+ textColor: '#000000',
161
+ fontSize: 17,
162
+ styles: {
163
+
164
+ }
165
+ }}
166
+ style={{
167
+ width: '100%',
168
+ height: 50,
169
+ marginVertical: 50,
170
+ borderWidth: 1,
171
+ borderColor: theme.colors.border,
172
+ borderRadius: 7.6,
173
+ }}
174
+ onCardChange={(cardDetails: any) => setCard(cardDetails)}
175
+ />
192
176
  </StripeProvider>
193
177
  {!!errors && (
194
178
  <ErrorMessage>
@@ -213,19 +197,16 @@ const StripeElementsFormUI = (props: any) => {
213
197
  </OText>
214
198
  </ErrorMessage>
215
199
  )}
216
- {!methodsPay?.includes(paymethod) && (
217
- <OButton
218
- text={t('SAVE_CARD', 'Save card')}
219
- bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
220
- borderColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
221
- style={styles.btnAddStyle}
222
- textStyle={{ color: 'white' }}
223
- imgRightSrc={null}
224
- onClick={() => handleSaveCard()}
225
- isDisabled={!isCompleted}
226
- isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
227
- />
228
- )}
200
+ <OButton
201
+ text={t('SAVE_CARD', 'Save card')}
202
+ bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
203
+ borderColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
204
+ style={styles.btnAddStyle}
205
+ textStyle={{ color: 'white', fontSize: 14 }}
206
+ imgRightSrc={null}
207
+ onClick={isCompleted ? () => handleSaveCard() : () => { }}
208
+ isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
209
+ />
229
210
  </View>
230
211
  )
231
212
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { useLanguage } from 'ordering-components/native'
2
+ import { useLanguage, useUtils } from 'ordering-components/native'
3
3
  import { SingleProductCard } from '../SingleProductCard'
4
4
  import { TaxInformationContainer, ProductContainer } from './styles'
5
5
  import { OText } from '../shared'
@@ -13,8 +13,9 @@ interface taxInformationParams {
13
13
  fixed?: number,
14
14
  percentage?: number,
15
15
  id: number,
16
- discounts?: any
17
- } | null,
16
+ discounts?: any,
17
+ rate_type?: number
18
+ },
18
19
  products: Array<any>,
19
20
  type: string
20
21
  }
@@ -27,6 +28,7 @@ export const TaxInformation = (props: taxInformationParams) => {
27
28
  } = props
28
29
 
29
30
  const [, t] = useLanguage()
31
+ const [{ parsePrice }] = useUtils()
30
32
 
31
33
  const includedOnPriceString = data?.type === 1 ? `(${t('INCLUDED_ON_PRICE', 'Included on price')})` : `(${t('NOT_INCLUDED_ON_PRICE', 'Not included on price')})`
32
34
  const offersHideArray = ['offer_target_2', 'offer_target_3']
@@ -56,8 +58,12 @@ export const TaxInformation = (props: taxInformationParams) => {
56
58
 
57
59
  return (
58
60
  <TaxInformationContainer>
61
+ <OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
62
+ {`${data?.name ||
63
+ t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${data?.rate_type !== 2 ? `(${typeof data?.rate === 'number' ? `${data?.rate}%` : `${parsePrice(data?.fixed ?? 0)} + ${data?.percentage}%`})` : ''} `}
64
+ </OText>
59
65
  {!!data?.description ? (
60
- <OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
66
+ <OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
61
67
  {t('DESCRIPTION', 'Description')}: {data?.description} {data?.type && !type?.includes('offer') && includedOnPriceString}
62
68
  </OText>
63
69
  ) : (
@@ -4,7 +4,7 @@ import {
4
4
  UpsellingPage as UpsellingPageController,
5
5
  useUtils,
6
6
  useLanguage,
7
- useOrder
7
+ useOrder
8
8
  } from 'ordering-components/native'
9
9
  import { useTheme } from 'styled-components/native';
10
10
  import { OText, OIcon, OBottomPopup, OButton } from '../shared'
@@ -62,7 +62,19 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
62
62
  borderRadius: 7.6,
63
63
  borderColor: theme.colors.textSecondary,
64
64
  height: 38
65
- }
65
+ },
66
+ headerItem: {
67
+ flexDirection: 'row',
68
+ alignItems: 'center',
69
+ marginVertical: 2,
70
+ marginHorizontal: 20,
71
+ },
72
+ btnBackArrow: {
73
+ borderWidth: 0,
74
+ backgroundColor: theme.colors.clear,
75
+ shadowColor: theme.colors.clear,
76
+ padding: 40,
77
+ },
66
78
  })
67
79
 
68
80
  const [modalIsOpen, setModalIsOpen] = useState(false)
@@ -77,11 +89,11 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
77
89
  ? cart?.products.map((product: any) => product.id)
78
90
  : []
79
91
 
80
- const productsList = !upsellingProducts.loading && !upsellingProducts.error
81
- ? upsellingProducts?.products?.length
82
- ? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
83
- : (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
84
- : []
92
+ const productsList = !upsellingProducts.loading && !upsellingProducts.error
93
+ ? upsellingProducts?.products?.length
94
+ ? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
95
+ : (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
96
+ : []
85
97
 
86
98
  useEffect(() => {
87
99
  if (!isCustomMode && !props.products) {
@@ -95,15 +107,11 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
95
107
  }
96
108
  }, [upsellingProducts.loading, upsellingProducts?.products.length])
97
109
 
98
- useEffect(() => {
99
- isCheckout && Object.keys(cart).length === 0 && onNavigationRedirect && onNavigationRedirect('MyOrders')
100
- }, [cart, isCheckout])
101
-
102
110
  const handleFormProduct = (product: any) => {
103
- onNavigationRedirect && onNavigationRedirect('ProductDetails', {
104
- product: product,
105
- businessId: product?.api?.businessId,
106
- businessSlug: business.slug,
111
+ onNavigationRedirect && onNavigationRedirect('ProductDetails', {
112
+ product: product,
113
+ businessId: product?.api?.businessId,
114
+ businessSlug: business.slug,
107
115
  })
108
116
  }
109
117
 
@@ -119,8 +127,8 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
119
127
  !upsellingProducts.loading && (
120
128
  <>
121
129
  {
122
- !upsellingProducts.error ? productsList.map((product: any) => (
123
- <Item key={product.id}>
130
+ !upsellingProducts.error ? productsList.map((product: any, i: number) => (
131
+ <Item key={`${product.id}_${i}`}>
124
132
  <View style={{ flexBasis: '57%' }}>
125
133
  <Details>
126
134
  <OText size={12} lineHeight={18} numberOfLines={1} ellipsizeMode='tail'>{product.name}</OText>
@@ -148,50 +156,54 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
148
156
  )
149
157
  }
150
158
 
151
- const UpsellingContent = () => {
152
- return (
153
- <>
154
- <TopBar style={{ paddingTop: Platform.OS == 'ios' ? 10 : 30 }}>
155
- <TopActions onPress={() => onGoBack()}>
156
- <OIcon src={theme.images.general.arrow_left} width={15} />
157
- </TopActions>
158
- </TopBar>
159
- <ScrollView style={{ marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
159
+ const UpsellingContent = () => {
160
+ return (
161
+ <>
162
+ <View style={{ ...styles.headerItem, flex: 1, marginTop: Platform.OS == 'ios' ? 35 : 70 }}>
163
+ <OButton
164
+ imgLeftSrc={theme.images.general.arrow_left}
165
+ imgRightSrc={null}
166
+ style={styles.btnBackArrow}
167
+ onClick={() => onGoBack()}
168
+ imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
169
+ />
170
+ </View>
171
+ <ScrollView style={{ marginTop: 10, marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
160
172
  {productsList.length > 0 &&
161
- <View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
162
- <OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
163
- <UpsellingLayout />
164
- </View>
165
- }
166
- <View style={{ paddingHorizontal: 40 }}>
167
- <OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
168
- <OrderSummary
169
- cart={cart}
170
- isCartPending={cart?.status === 2}
171
- onNavigationRedirect={onNavigationRedirect}
172
- />
173
- </View>
174
- </ScrollView>
175
- <View
176
- style={{
177
- alignItems: 'center',
178
- bottom: props.isPage ? Platform.OS === 'ios' ? 0 : 20 : Platform.OS === 'ios' ? bottom + 59 : bottom + 125
179
- }}
180
- >
181
- <OButton
182
- imgRightSrc=''
183
- text={t('CHECKOUT', 'Checkout')}
184
- style={{...styles.closeUpsellingButton}}
185
- textStyle={{ color: theme.colors.white, fontSize: 14 }}
186
- onClick={() => {
187
- handleUpsellingPage()
188
- setIsCheckout(true)
189
- }}
190
- />
191
- </View>
192
- </>
193
- )
194
- }
173
+ <View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
174
+ <OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
175
+ <UpsellingLayout />
176
+ </View>
177
+ }
178
+ <View style={{ paddingHorizontal: 40 }}>
179
+ <OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
180
+ <OrderSummary
181
+ cart={cart}
182
+ isCartPending={cart?.status === 2}
183
+ onNavigationRedirect={onNavigationRedirect}
184
+ />
185
+ </View>
186
+ </ScrollView>
187
+ <View
188
+ style={{
189
+ alignItems: 'center',
190
+ bottom: props.isPage ? Platform.OS === 'ios' ? 0 : 20 : Platform.OS === 'ios' ? bottom + 59 : bottom + 125
191
+ }}
192
+ >
193
+ <OButton
194
+ imgRightSrc=''
195
+ text={t('CHECKOUT', 'Checkout')}
196
+ style={{ ...styles.closeUpsellingButton }}
197
+ textStyle={{ color: theme.colors.white, fontSize: 14 }}
198
+ onClick={() => {
199
+ handleUpsellingPage()
200
+ setIsCheckout(true)
201
+ }}
202
+ />
203
+ </View>
204
+ </>
205
+ )
206
+ }
195
207
 
196
208
  return (
197
209
  <>
@@ -199,20 +211,20 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
199
211
  <UpsellingLayout />
200
212
  ) : (
201
213
  <>
202
- {props.isPage ? (
203
- <UpsellingContent />
204
- ) : (
205
- canOpenUpselling && !modalIsOpen && (
206
- <OBottomPopup
207
- title={''}
208
- open={openUpselling}
209
- onClose={() => handleUpsellingPage()}
210
- isStatusBar
211
- >
212
- <UpsellingContent />
213
- </OBottomPopup>
214
- )
215
- )}
214
+ {props.isPage ? (
215
+ <UpsellingContent />
216
+ ) : (
217
+ canOpenUpselling && !modalIsOpen && (
218
+ <OBottomPopup
219
+ title={''}
220
+ open={openUpselling}
221
+ onClose={() => handleUpsellingPage()}
222
+ isStatusBar
223
+ >
224
+ <UpsellingContent />
225
+ </OBottomPopup>
226
+ )
227
+ )}
216
228
  </>
217
229
  )}
218
230
  </>