ordering-ui-react-native 0.12.54 → 0.12.58

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 (205) hide show
  1. package/package.json +1 -1
  2. package/src/components/Cart/index.tsx +50 -16
  3. package/src/components/OrderDetails/index.tsx +8 -0
  4. package/src/components/OrderSummary/index.tsx +38 -3
  5. package/src/layouts/Container.tsx +1 -1
  6. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +8 -0
  7. package/themes/business/src/components/OrderDetails/styles.tsx +1 -0
  8. package/themes/business/src/layouts/Container.tsx +3 -1
  9. package/themes/doordash/src/components/Cart/index.tsx +36 -2
  10. package/themes/doordash/src/components/OrderDetails/index.tsx +8 -0
  11. package/themes/doordash/src/components/OrderSummary/index.tsx +36 -3
  12. package/themes/doordash/src/layouts/Container.tsx +1 -1
  13. package/themes/instacart/src/components/Cart/index.tsx +37 -3
  14. package/themes/instacart/src/components/OrderDetails/index.tsx +8 -0
  15. package/themes/instacart/src/components/OrderSummary/index.tsx +37 -4
  16. package/themes/instacart/src/layouts/Container.tsx +1 -1
  17. package/themes/kiosk/src/layouts/Container.tsx +2 -1
  18. package/themes/original/src/components/Cart/index.tsx +268 -234
  19. package/themes/original/src/components/OrderDetails/index.tsx +723 -715
  20. package/themes/original/src/components/OrderSummary/index.tsx +37 -3
  21. package/themes/original/src/layouts/Container.tsx +1 -1
  22. package/themes/single-business/src/components/Cart/index.tsx +92 -16
  23. package/themes/single-business/src/components/Cart/styles.tsx +39 -0
  24. package/themes/single-business/src/components/CartContent/index.tsx +56 -52
  25. package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
  26. package/themes/single-business/src/components/PhoneInputNumber/index.tsx +103 -112
  27. package/themes/single-business/src/components/UserDetails/index.tsx +107 -111
  28. package/themes/single-business/src/components/UserDetails/styles.tsx +3 -8
  29. package/themes/single-business/src/components/UserFormDetails/index.tsx +279 -326
  30. package/themes/single-business/src/components/UserFormDetails/styles.tsx +7 -5
  31. package/themes/single-business/src/layouts/Container.tsx +1 -1
  32. package/themes/uber-eats/src/components/Cart/index.tsx +37 -3
  33. package/themes/uber-eats/src/components/OrderDetails/index.tsx +8 -0
  34. package/themes/uber-eats/src/components/OrderSummary/index.tsx +40 -6
  35. package/themes/uber-eats/src/layouts/Container.tsx +1 -1
  36. package/themes/franchises/index.tsx +0 -111
  37. package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
  38. package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
  39. package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
  40. package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
  41. package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
  42. package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
  43. package/themes/franchises/src/components/AddressList/index.tsx +0 -338
  44. package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
  45. package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
  46. package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
  47. package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
  48. package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
  49. package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
  50. package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
  51. package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
  52. package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
  53. package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
  54. package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
  55. package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
  56. package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
  57. package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
  58. package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
  59. package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
  60. package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
  61. package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
  62. package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
  63. package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
  64. package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
  65. package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
  66. package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
  67. package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
  68. package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
  69. package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
  70. package/themes/franchises/src/components/Cart/index.tsx +0 -298
  71. package/themes/franchises/src/components/Cart/styles.tsx +0 -28
  72. package/themes/franchises/src/components/CartContent/index.tsx +0 -60
  73. package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
  74. package/themes/franchises/src/components/Checkout/index.tsx +0 -664
  75. package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
  76. package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
  77. package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
  78. package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
  79. package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
  80. package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
  81. package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
  82. package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
  83. package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
  84. package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
  85. package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
  86. package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
  87. package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
  88. package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
  89. package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
  90. package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
  91. package/themes/franchises/src/components/Help/index.tsx +0 -56
  92. package/themes/franchises/src/components/Help/styles.tsx +0 -11
  93. package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
  94. package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
  95. package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
  96. package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
  97. package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
  98. package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
  99. package/themes/franchises/src/components/Home/index.tsx +0 -102
  100. package/themes/franchises/src/components/Home/styles.tsx +0 -18
  101. package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
  102. package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
  103. package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
  104. package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
  105. package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
  106. package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
  107. package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
  108. package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
  109. package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
  110. package/themes/franchises/src/components/Messages/index.tsx +0 -359
  111. package/themes/franchises/src/components/Messages/styles.tsx +0 -20
  112. package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
  113. package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
  114. package/themes/franchises/src/components/NavBar/index.tsx +0 -129
  115. package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
  116. package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
  117. package/themes/franchises/src/components/Notifications/index.tsx +0 -120
  118. package/themes/franchises/src/components/Notifications/styles.ts +0 -21
  119. package/themes/franchises/src/components/OrderDetails/index.tsx +0 -820
  120. package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
  121. package/themes/franchises/src/components/OrderSummary/index.tsx +0 -232
  122. package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
  123. package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
  124. package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
  125. package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
  126. package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
  127. package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
  128. package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
  129. package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
  130. package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
  131. package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
  132. package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
  133. package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
  134. package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
  135. package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
  136. package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
  137. package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
  138. package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
  139. package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
  140. package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
  141. package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
  142. package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
  143. package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
  144. package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
  145. package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
  146. package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
  147. package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
  148. package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
  149. package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
  150. package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
  151. package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
  152. package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
  153. package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
  154. package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
  155. package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
  156. package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
  157. package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
  158. package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
  159. package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
  160. package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
  161. package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
  162. package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
  163. package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
  164. package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
  165. package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
  166. package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
  167. package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
  168. package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
  169. package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
  170. package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
  171. package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
  172. package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
  173. package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
  174. package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
  175. package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
  176. package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
  177. package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
  178. package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
  179. package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
  180. package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
  181. package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
  182. package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
  183. package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
  184. package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
  185. package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
  186. package/themes/franchises/src/components/shared/OButton.tsx +0 -132
  187. package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
  188. package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
  189. package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
  190. package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
  191. package/themes/franchises/src/components/shared/OInput.tsx +0 -113
  192. package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
  193. package/themes/franchises/src/components/shared/OModal.tsx +0 -172
  194. package/themes/franchises/src/components/shared/OText.tsx +0 -52
  195. package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
  196. package/themes/franchises/src/components/shared/OToast.tsx +0 -93
  197. package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
  198. package/themes/franchises/src/components/shared/index.tsx +0 -29
  199. package/themes/franchises/src/config/constants.tsx +0 -57
  200. package/themes/franchises/src/layouts/Container.tsx +0 -23
  201. package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
  202. package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
  203. package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
  204. package/themes/franchises/src/types/index.tsx +0 -445
  205. package/themes/franchises/src/utils/index.tsx +0 -222
@@ -1,11 +1,11 @@
1
1
  import React, { useState } from 'react';
2
2
  import {
3
- Cart as CartController,
4
- useOrder,
5
- useLanguage,
6
- useConfig,
7
- useUtils,
8
- useValidationFields,
3
+ Cart as CartController,
4
+ useOrder,
5
+ useLanguage,
6
+ useConfig,
7
+ useUtils,
8
+ useValidationFields,
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
11
  import { CContainer, CheckoutAction } from './styles';
@@ -16,85 +16,87 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
16
16
  import { BusinessItemAccordion } from '../BusinessItemAccordion';
17
17
  import { CouponControl } from '../CouponControl';
18
18
 
19
- import { OButton, OModal, OText } from '../shared';
19
+ import { OButton, OInput, OModal, OText } from '../shared';
20
20
  import { ProductForm } from '../ProductForm';
21
21
  import { UpsellingProducts } from '../UpsellingProducts';
22
22
  import { verifyDecimals } from '../../utils';
23
- import { TouchableOpacity } from 'react-native';
23
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
24
24
  import AntIcon from 'react-native-vector-icons/AntDesign'
25
25
  import { TaxInformation } from '../TaxInformation';
26
26
 
27
27
  const CartUI = (props: any) => {
28
- const {
29
- cart,
30
- clearCart,
31
- changeQuantity,
32
- getProductMax,
33
- offsetDisabled,
34
- removeProduct,
35
- handleCartOpen,
36
- setIsCartsLoading,
37
- hideUpselling
38
- // isFromCart
39
- } = props
28
+ const {
29
+ cart,
30
+ clearCart,
31
+ changeQuantity,
32
+ getProductMax,
33
+ offsetDisabled,
34
+ removeProduct,
35
+ handleCartOpen,
36
+ setIsCartsLoading,
37
+ hideUpselling,
38
+ handleChangeComment,
39
+ commentState
40
+ // isFromCart
41
+ } = props
40
42
 
41
- const theme = useTheme();
43
+ const theme = useTheme();
42
44
 
43
- const [, t] = useLanguage()
44
- const [orderState] = useOrder()
45
- const [{ configs }] = useConfig();
46
- const [{ parsePrice, parseNumber, parseDate }] = useUtils()
47
- const [validationFields] = useValidationFields()
45
+ const [, t] = useLanguage()
46
+ const [orderState] = useOrder()
47
+ const [{ configs }] = useConfig();
48
+ const [{ parsePrice, parseNumber, parseDate }] = useUtils()
49
+ const [validationFields] = useValidationFields()
48
50
 
49
- const [openProduct, setModalIsOpen] = useState(false)
50
- const [curProduct, setCurProduct] = useState<any>(null)
51
- const [openUpselling, setOpenUpselling] = useState(false)
52
- const [canOpenUpselling, setCanOpenUpselling] = useState(false)
51
+ const [openProduct, setModalIsOpen] = useState(false)
52
+ const [curProduct, setCurProduct] = useState<any>(null)
53
+ const [openUpselling, setOpenUpselling] = useState(false)
54
+ const [canOpenUpselling, setCanOpenUpselling] = useState(false)
53
55
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
54
56
 
55
- const isCartPending = cart?.status === 2
56
- const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
57
+ const isCartPending = cart?.status === 2
58
+ const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
57
59
 
58
- const momentFormatted = !orderState?.option?.moment
59
- ? t('RIGHT_NOW', 'Right Now')
60
- : parseDate(orderState?.option?.moment, { outputFormat: 'YYYY-MM-DD HH:mm' })
60
+ const momentFormatted = !orderState?.option?.moment
61
+ ? t('RIGHT_NOW', 'Right Now')
62
+ : parseDate(orderState?.option?.moment, { outputFormat: 'YYYY-MM-DD HH:mm' })
61
63
 
62
- const handleDeleteClick = (product: any) => {
63
- removeProduct(product, cart)
64
- }
64
+ const handleDeleteClick = (product: any) => {
65
+ removeProduct(product, cart)
66
+ }
65
67
 
66
- const handleEditProduct = (product: any) => {
67
- setCurProduct(product)
68
- setModalIsOpen(true)
69
- }
68
+ const handleEditProduct = (product: any) => {
69
+ setCurProduct(product)
70
+ setModalIsOpen(true)
71
+ }
70
72
 
71
- const handlerProductAction = (product: any) => {
72
- if (Object.keys(product).length) {
73
- setModalIsOpen(false)
74
- }
75
- }
73
+ const handlerProductAction = (product: any) => {
74
+ if (Object.keys(product).length) {
75
+ setModalIsOpen(false)
76
+ }
77
+ }
76
78
 
77
- const handleClearProducts = async () => {
78
- try {
79
- setIsCartsLoading && setIsCartsLoading(true)
80
- const result = await clearCart(cart?.uuid)
81
- setIsCartsLoading && setIsCartsLoading(false)
82
- } catch (error) {
83
- setIsCartsLoading && setIsCartsLoading(false)
84
- }
85
- }
79
+ const handleClearProducts = async () => {
80
+ try {
81
+ setIsCartsLoading && setIsCartsLoading(true)
82
+ const result = await clearCart(cart?.uuid)
83
+ setIsCartsLoading && setIsCartsLoading(false)
84
+ } catch (error) {
85
+ setIsCartsLoading && setIsCartsLoading(false)
86
+ }
87
+ }
86
88
 
87
- const handleUpsellingPage = () => {
88
- setOpenUpselling(false)
89
- setCanOpenUpselling(false)
90
- props.onNavigationRedirect('CheckoutNavigator', {
91
- screen: 'CheckoutPage',
92
- cartUuid: cart?.uuid,
93
- businessLogo: cart?.business?.logo,
94
- businessName: cart?.business?.name,
95
- cartTotal: cart?.total
96
- })
97
- }
89
+ const handleUpsellingPage = () => {
90
+ setOpenUpselling(false)
91
+ setCanOpenUpselling(false)
92
+ props.onNavigationRedirect('CheckoutNavigator', {
93
+ screen: 'CheckoutPage',
94
+ cartUuid: cart?.uuid,
95
+ businessLogo: cart?.business?.logo,
96
+ businessName: cart?.business?.name,
97
+ cartTotal: cart?.total
98
+ })
99
+ }
98
100
 
99
101
  const getIncludedTaxes = () => {
100
102
  if (cart?.taxes === null) {
@@ -106,51 +108,51 @@ const CartUI = (props: any) => {
106
108
  }
107
109
  }
108
110
 
109
- return (
110
- <CContainer>
111
- <BusinessItemAccordion
112
- cart={cart}
113
- moment={momentFormatted}
114
- handleClearProducts={handleClearProducts}
115
- handleCartOpen={handleCartOpen}
116
- onNavigationRedirect={props.onNavigationRedirect}
117
- >
118
- {cart?.products?.length > 0 && cart?.products.map((product: any) => (
119
- <ProductItemAccordion
120
- key={product.code}
121
- isCartPending={isCartPending}
122
- isCartProduct
123
- product={product}
124
- changeQuantity={changeQuantity}
125
- getProductMax={getProductMax}
126
- offsetDisabled={offsetDisabled}
127
- onDeleteProduct={handleDeleteClick}
128
- onEditProduct={handleEditProduct}
129
- />
130
- ))}
111
+ return (
112
+ <CContainer>
113
+ <BusinessItemAccordion
114
+ cart={cart}
115
+ moment={momentFormatted}
116
+ handleClearProducts={handleClearProducts}
117
+ handleCartOpen={handleCartOpen}
118
+ onNavigationRedirect={props.onNavigationRedirect}
119
+ >
120
+ {cart?.products?.length > 0 && cart?.products.map((product: any) => (
121
+ <ProductItemAccordion
122
+ key={product.code}
123
+ isCartPending={isCartPending}
124
+ isCartProduct
125
+ product={product}
126
+ changeQuantity={changeQuantity}
127
+ getProductMax={getProductMax}
128
+ offsetDisabled={offsetDisabled}
129
+ onDeleteProduct={handleDeleteClick}
130
+ onEditProduct={handleEditProduct}
131
+ />
132
+ ))}
131
133
 
132
- {cart?.valid_products && (
133
- <OSBill>
134
- <OSTable>
135
- <OText size={12} lineHeight={18}>{t('SUBTOTAL', 'Subtotal')}</OText>
136
- <OText size={12} lineHeight={18}>
134
+ {cart?.valid_products && (
135
+ <OSBill>
136
+ <OSTable>
137
+ <OText size={12} lineHeight={18}>{t('SUBTOTAL', 'Subtotal')}</OText>
138
+ <OText size={12} lineHeight={18}>
137
139
  {parsePrice(cart?.subtotal + getIncludedTaxes())}
138
- </OText>
139
- </OSTable>
140
- {cart?.discount > 0 && cart?.total >= 0 && (
141
- <OSTable>
142
- {cart?.discount_type === 1 ? (
143
- <OText size={12} lineHeight={18}>
144
- {t('DISCOUNT', 'Discount')}
145
- <OText size={12} lineHeight={18}>{`(${verifyDecimals(cart?.discount_rate, parsePrice)}%)`}</OText>
146
- </OText>
147
- ) : (
148
- <OText size={12} lineHeight={18}>{t('DISCOUNT', 'Discount')}</OText>
149
- )}
150
- <OText size={12} lineHeight={18}>- {parsePrice(cart?.discount || 0)}</OText>
151
- </OSTable>
152
- )}
153
- {
140
+ </OText>
141
+ </OSTable>
142
+ {cart?.discount > 0 && cart?.total >= 0 && (
143
+ <OSTable>
144
+ {cart?.discount_type === 1 ? (
145
+ <OText size={12} lineHeight={18}>
146
+ {t('DISCOUNT', 'Discount')}
147
+ <OText size={12} lineHeight={18}>{`(${verifyDecimals(cart?.discount_rate, parsePrice)}%)`}</OText>
148
+ </OText>
149
+ ) : (
150
+ <OText size={12} lineHeight={18}>{t('DISCOUNT', 'Discount')}</OText>
151
+ )}
152
+ <OText size={12} lineHeight={18}>- {parsePrice(cart?.discount || 0)}</OText>
153
+ </OSTable>
154
+ )}
155
+ {
154
156
  cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
155
157
  <OSTable key={tax.id}>
156
158
  <OSRow>
@@ -167,126 +169,158 @@ const CartUI = (props: any) => {
167
169
  ))
168
170
  }
169
171
  {
170
- cart?.fees?.length > 0 && cart?.fees?.filter((fee : any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
171
- <OSTable key={fee?.id}>
172
- <OSRow>
173
- <OText numberOfLines={1}>
174
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
175
- ({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
176
- </OText>
177
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })} >
178
- <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
179
- </TouchableOpacity>
180
- </OSRow>
181
- <OText>{parsePrice(fee?.summary?.fixed + fee?.summary?.percentage || 0)}</OText>
182
- </OSTable>
172
+ cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
173
+ <OSTable key={fee?.id}>
174
+ <OSRow>
175
+ <OText numberOfLines={1}>
176
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
177
+ ({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
178
+ </OText>
179
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })} >
180
+ <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
181
+ </TouchableOpacity>
182
+ </OSRow>
183
+ <OText>{parsePrice(fee?.summary?.fixed + fee?.summary?.percentage || 0)}</OText>
184
+ </OSTable>
183
185
  ))
184
186
  }
185
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
186
- <OSTable>
187
- <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
188
- <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
189
- </OSTable>
190
- )}
191
- {cart?.driver_tip > 0 && (
192
- <OSTable>
193
- <OText size={12} lineHeight={18}>
194
- {t('DRIVER_TIP', 'Driver tip')}
195
- {cart?.driver_tip_rate > 0 &&
196
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
197
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
198
- (
199
- `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
200
- )}
201
- </OText>
202
- <OText size={12} lineHeight={18}>{parsePrice(cart?.driver_tip)}</OText>
203
- </OSTable>
204
- )}
205
- {cart?.service_fee > 0 && (
206
- <OSTable>
207
- <OText size={12} lineHeight={18}>
208
- {t('SERVICE_FEE', 'Service Fee')}
209
- {`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
210
- </OText>
211
- <OText size={12} lineHeight={18}>{parsePrice(cart?.service_fee)}</OText>
212
- </OSTable>
213
- )}
214
- {isCouponEnabled && !isCartPending && (
215
- <OSTable>
216
- <OSCoupon>
217
- <CouponControl
218
- businessId={cart.business_id}
219
- price={cart.total}
220
- />
221
- </OSCoupon>
222
- </OSTable>
223
- )}
187
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
188
+ <OSTable>
189
+ <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
190
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
191
+ </OSTable>
192
+ )}
193
+ {cart?.driver_tip > 0 && (
194
+ <OSTable>
195
+ <OText size={12} lineHeight={18}>
196
+ {t('DRIVER_TIP', 'Driver tip')}
197
+ {cart?.driver_tip_rate > 0 &&
198
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
199
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
200
+ (
201
+ `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
202
+ )}
203
+ </OText>
204
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.driver_tip)}</OText>
205
+ </OSTable>
206
+ )}
207
+ {cart?.service_fee > 0 && (
208
+ <OSTable>
209
+ <OText size={12} lineHeight={18}>
210
+ {t('SERVICE_FEE', 'Service Fee')}
211
+ {`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
212
+ </OText>
213
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.service_fee)}</OText>
214
+ </OSTable>
215
+ )}
216
+ {isCouponEnabled && !isCartPending && (
217
+ <OSTable>
218
+ <OSCoupon>
219
+ <CouponControl
220
+ businessId={cart.business_id}
221
+ price={cart.total}
222
+ />
223
+ </OSCoupon>
224
+ </OSTable>
225
+ )}
224
226
 
225
- <OSTotal>
226
- <OSTable style={{ marginTop: 15 }}>
227
- <OText size={14} lineHeight={21} weight={'600'}>
228
- {t('TOTAL', 'Total')}
229
- </OText>
230
- <OText size={14} lineHeight={21} weight={'600'}>
231
- {cart?.total >= 1 && parsePrice(cart?.total)}
232
- </OText>
233
- </OSTable>
234
- </OSTotal>
235
- </OSBill>
236
- )}
237
- {cart?.valid_products && (
238
- <CheckoutAction>
239
- <OButton
240
- text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
241
- !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
242
- ) : !cart?.valid_address ? (
243
- `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
244
- ) : (
245
- `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
246
- )}
247
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
248
- isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
249
- borderColor={theme.colors.primary}
250
- imgRightSrc={null}
251
- textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
252
- onClick={() => setOpenUpselling(true)}
253
- style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
254
- />
255
- </CheckoutAction>
256
- )}
257
- </BusinessItemAccordion>
258
- <OModal
259
- open={openProduct}
260
- entireModal
261
- customClose
262
- onClose={() => setModalIsOpen(false)}
263
- >
264
- <ProductForm
265
- isCartProduct
266
- productCart={curProduct}
267
- businessSlug={cart?.business?.slug}
268
- businessId={cart?.business_id}
269
- categoryId={curProduct?.category_id}
270
- productId={curProduct?.id}
271
- onSave={handlerProductAction}
272
- onClose={() => setModalIsOpen(false)}
273
- />
227
+ <OSTotal>
228
+ <OSTable style={{ marginTop: 15 }}>
229
+ <OText size={14} lineHeight={21} weight={'600'}>
230
+ {t('TOTAL', 'Total')}
231
+ </OText>
232
+ <OText size={14} lineHeight={21} weight={'600'}>
233
+ {cart?.total >= 1 && parsePrice(cart?.total)}
234
+ </OText>
235
+ </OSTable>
236
+ </OSTotal>
237
+ {cart?.status !== 2 && (
238
+ <OSTable>
239
+ <View style={{ width: '100%', marginTop: 20 }}>
240
+ <OText size={12} lineHeight={18}>{t('COMMENTS', 'Comments')}</OText>
241
+ <View style={{ flex: 1, width: '100%' }}>
242
+ <OInput
243
+ value={cart?.comment}
244
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
245
+ onChange={(value: string) => handleChangeComment(value)}
246
+ style={{
247
+ alignItems: 'flex-start',
248
+ width: '100%',
249
+ height: 100,
250
+ borderColor: theme.colors.textSecondary,
251
+ paddingRight: 50,
252
+ marginTop: 10
253
+ }}
254
+ multiline
255
+ />
256
+ {commentState?.loading && (
257
+ <View style={{ position: 'absolute', right: 20 }}>
258
+ <ActivityIndicator
259
+ size='large'
260
+ style={{ height: 100 }}
261
+ color={theme.colors.primary}
262
+ />
263
+ </View>
264
+ )}
265
+ </View>
266
+ </View>
267
+ </OSTable>
268
+ )}
269
+ </OSBill>
270
+ )}
271
+ {cart?.valid_products && (
272
+ <CheckoutAction>
273
+ <OButton
274
+ text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
275
+ !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
276
+ ) : !cart?.valid_address ? (
277
+ `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
278
+ ) : (
279
+ `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
280
+ )}
281
+ bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
282
+ isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
283
+ borderColor={theme.colors.primary}
284
+ imgRightSrc={null}
285
+ textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
286
+ onClick={() => setOpenUpselling(true)}
287
+ style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
288
+ />
289
+ </CheckoutAction>
290
+ )}
291
+ </BusinessItemAccordion>
292
+ <OModal
293
+ open={openProduct}
294
+ entireModal
295
+ customClose
296
+ onClose={() => setModalIsOpen(false)}
297
+ >
298
+ <ProductForm
299
+ isCartProduct
300
+ productCart={curProduct}
301
+ businessSlug={cart?.business?.slug}
302
+ businessId={cart?.business_id}
303
+ categoryId={curProduct?.category_id}
304
+ productId={curProduct?.id}
305
+ onSave={handlerProductAction}
306
+ onClose={() => setModalIsOpen(false)}
307
+ />
274
308
 
275
- </OModal>
309
+ </OModal>
276
310
 
277
- {openUpselling && (
278
- <UpsellingProducts
279
- handleUpsellingPage={handleUpsellingPage}
280
- openUpselling={openUpselling}
281
- businessId={cart?.business_id}
282
- business={cart?.business}
283
- cartProducts={cart?.products}
284
- canOpenUpselling={canOpenUpselling}
285
- setCanOpenUpselling={setCanOpenUpselling}
286
- handleCloseUpsellingPage={() => { }}
287
- isFromCart
288
- />
289
- )}
311
+ {openUpselling && (
312
+ <UpsellingProducts
313
+ handleUpsellingPage={handleUpsellingPage}
314
+ openUpselling={openUpselling}
315
+ businessId={cart?.business_id}
316
+ business={cart?.business}
317
+ cartProducts={cart?.products}
318
+ canOpenUpselling={canOpenUpselling}
319
+ setCanOpenUpselling={setCanOpenUpselling}
320
+ handleCloseUpsellingPage={() => { }}
321
+ isFromCart
322
+ />
323
+ )}
290
324
  <OModal
291
325
  open={openTaxModal.open}
292
326
  onClose={() => setOpenTaxModal({ open: false, data: null })}
@@ -294,17 +328,17 @@ const CartUI = (props: any) => {
294
328
  >
295
329
  <TaxInformation data={openTaxModal.data} products={cart.products} />
296
330
  </OModal>
297
- </CContainer>
298
- )
331
+ </CContainer>
332
+ )
299
333
  }
300
334
 
301
335
  export const Cart = (props: any) => {
302
- const cartProps = {
303
- ...props,
304
- UIComponent: CartUI
305
- }
336
+ const cartProps = {
337
+ ...props,
338
+ UIComponent: CartUI
339
+ }
306
340
 
307
- return (
308
- <CartController {...cartProps} />
309
- )
341
+ return (
342
+ <CartController {...cartProps} />
343
+ )
310
344
  }