ordering-ui-react-native 0.12.56 → 0.12.60

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