ordering-ui-react-native 0.15.7 → 0.15.9-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.
- package/package.json +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/Home/index.tsx +3 -5
- package/src/components/LanguageSelector/index.tsx +66 -97
- package/src/components/LanguageSelector/styles.tsx +4 -17
- package/src/components/Messages/index.tsx +38 -30
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +25 -4
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +35 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/types/index.tsx +2 -9
- package/src/utils/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/Chat/index.tsx +32 -31
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +27 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +70 -116
- package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
- package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -126
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/original/index.tsx +177 -0
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +28 -2
- package/themes/original/src/components/AppleLogin/index.tsx +119 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +95 -44
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +32 -21
- package/themes/original/src/components/BusinessListingSearch/index.tsx +7 -3
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +129 -22
- package/themes/original/src/components/BusinessProductsList/styles.tsx +32 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -28
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessesListing/index.tsx +40 -53
- package/themes/original/src/components/Cart/index.tsx +40 -9
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +47 -31
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LoginForm/index.tsx +156 -70
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/Messages/index.tsx +52 -45
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +104 -126
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +15 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +6 -2
- package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +31 -20
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +17 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +16 -16
- package/themes/original/src/components/UserProfileForm/index.tsx +8 -6
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +63 -23
- package/themes/original/src/utils/index.tsx +12 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -72,6 +72,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
72
72
|
borderWidth: 0,
|
|
73
73
|
backgroundColor: theme.colors.clear,
|
|
74
74
|
shadowColor: theme.colors.clear,
|
|
75
|
+
padding: 40,
|
|
75
76
|
},
|
|
76
77
|
searchIcon: {
|
|
77
78
|
borderWidth: 0,
|
|
@@ -98,24 +99,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
const onProductClick = (product: any) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
productCart: cartProduct,
|
|
107
|
-
businessSlug: business?.slug,
|
|
108
|
-
categoryId: cartProduct?.category_id,
|
|
109
|
-
productId: cartProduct?.id,
|
|
110
|
-
})
|
|
111
|
-
} else {
|
|
112
|
-
onRedirect('ProductDetails', {
|
|
113
|
-
product: product,
|
|
114
|
-
businessSlug: business.slug,
|
|
115
|
-
businessId: business.id,
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
|
|
102
|
+
onRedirect('ProductDetails', {
|
|
103
|
+
product: product,
|
|
104
|
+
businessSlug: business.slug,
|
|
105
|
+
businessId: business.id,
|
|
106
|
+
})
|
|
119
107
|
}
|
|
120
108
|
|
|
121
109
|
const handleCancel = () => {
|
|
@@ -169,8 +157,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
169
157
|
|
|
170
158
|
const handleTouchDrag = useCallback(() => {
|
|
171
159
|
setCategoryClicked(false);
|
|
172
|
-
|
|
173
|
-
|
|
160
|
+
}, []);
|
|
161
|
+
|
|
174
162
|
const handleBackNavigation = () => {
|
|
175
163
|
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
176
164
|
}
|
|
@@ -251,7 +239,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
251
239
|
selectedCategoryId={selectedCategoryId}
|
|
252
240
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
253
241
|
setSelectedCategoryId={setSelectedCategoryId}
|
|
254
|
-
|
|
242
|
+
setCategoryClicked={setCategoryClicked}
|
|
255
243
|
/>
|
|
256
244
|
)}
|
|
257
245
|
</>
|
|
@@ -310,16 +298,18 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
310
298
|
{!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
|
|
311
299
|
<FloatingButton
|
|
312
300
|
btnText={
|
|
313
|
-
|
|
314
|
-
? t('
|
|
315
|
-
:
|
|
301
|
+
openUpselling
|
|
302
|
+
? t('LOADING', 'Loading')
|
|
303
|
+
: currentCart?.subtotal >= currentCart?.minimum
|
|
304
|
+
? t('VIEW_ORDER', 'View Order')
|
|
305
|
+
: `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
|
|
316
306
|
}
|
|
317
|
-
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum}
|
|
307
|
+
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
318
308
|
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
319
309
|
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
320
310
|
btnLeftValue={currentCart?.products?.length}
|
|
321
311
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
322
|
-
disabled={currentCart?.subtotal < currentCart?.minimum}
|
|
312
|
+
disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
|
|
323
313
|
handleClick={() => setOpenUpselling(true)}
|
|
324
314
|
/>
|
|
325
315
|
)}
|
|
@@ -329,13 +319,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
329
319
|
business={currentCart?.business}
|
|
330
320
|
cartProducts={currentCart?.products}
|
|
331
321
|
cart={currentCart}
|
|
332
|
-
|
|
322
|
+
setOpenUpselling={setOpenUpselling}
|
|
333
323
|
handleUpsellingPage={handleUpsellingPage}
|
|
334
324
|
handleCloseUpsellingPage={handleCloseUpsellingPage}
|
|
335
325
|
openUpselling={openUpselling}
|
|
336
326
|
canOpenUpselling={canOpenUpselling}
|
|
337
327
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
338
|
-
|
|
328
|
+
onRedirect={onRedirect}
|
|
339
329
|
/>
|
|
340
330
|
)}
|
|
341
331
|
</SafeAreaView>
|
|
@@ -90,33 +90,12 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
90
90
|
</View>
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
-
const ReviewItem = ({ comment, created_at, total
|
|
93
|
+
const ReviewItem = ({ comment, created_at, total }: any) => (
|
|
94
94
|
<View style={{ marginBottom: 30 }}>
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
<OIcon
|
|
98
|
-
url={theme.images.dummies.customerPhoto}
|
|
99
|
-
width={38}
|
|
100
|
-
height={38}
|
|
101
|
-
style={{
|
|
102
|
-
borderRadius: 7.6,
|
|
103
|
-
borderWidth: 1,
|
|
104
|
-
borderColor: theme.colors.border,
|
|
105
|
-
marginEnd: 9,
|
|
106
|
-
}}
|
|
107
|
-
/>
|
|
108
|
-
<View>
|
|
109
|
-
<OText size={12} color={theme.colors.textNormal} weight={'500'}>
|
|
110
|
-
{customer?.name || 'Jane Cooper'}
|
|
111
|
-
</OText>
|
|
112
|
-
<OText size={10} color={theme.colors.textSecondary}>
|
|
113
|
-
{moment(created_at).format('MMMM d, yyyy • hh:mm')}
|
|
114
|
-
</OText>
|
|
115
|
-
</View>
|
|
116
|
-
</View>
|
|
117
|
-
<OText size={10} color={theme.colors.textNormal}>
|
|
118
|
-
{comment}
|
|
95
|
+
<OText size={12} color={theme.colors.textSecondary}>
|
|
96
|
+
{moment(created_at).format('MMMM d, yyyy • hh:mm')}
|
|
119
97
|
</OText>
|
|
98
|
+
<OText size={12} color={theme.colors.textNormal}>{comment}</OText>
|
|
120
99
|
</View>
|
|
121
100
|
);
|
|
122
101
|
|
|
@@ -61,7 +61,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
61
61
|
handleChangeSearch,
|
|
62
62
|
businessId
|
|
63
63
|
} = props;
|
|
64
|
-
|
|
65
64
|
const theme = useTheme();
|
|
66
65
|
const isFocused = useIsFocused();
|
|
67
66
|
const appState = useRef(AppState.currentState)
|
|
@@ -120,7 +119,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
120
119
|
|
|
121
120
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
122
121
|
Number(configs?.max_days_preorder?.value) > 0
|
|
123
|
-
|
|
122
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
124
123
|
const timerId = useRef<any>(false)
|
|
125
124
|
// const panResponder = useRef(
|
|
126
125
|
// PanResponder.create({
|
|
@@ -166,25 +165,22 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
166
165
|
return R * c
|
|
167
166
|
}
|
|
168
167
|
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
if (businessesList.businesses.length > 0) {
|
|
171
|
-
const fb = businessesList.businesses.filter((b) => b.featured == true);
|
|
172
|
-
const ary = [];
|
|
173
|
-
while (fb.length > 0) {
|
|
174
|
-
ary.push(fb.splice(0, 2));
|
|
175
|
-
}
|
|
176
|
-
setFeaturedBusinesses(ary);
|
|
177
|
-
}
|
|
178
|
-
}, [businessesList.businesses]);
|
|
179
|
-
|
|
180
168
|
const resetInactivityTimeout = () => {
|
|
181
169
|
clearTimeout(timerId.current)
|
|
182
170
|
timerId.current = setInterval(() => {
|
|
183
171
|
getBusinesses(true)
|
|
184
|
-
},
|
|
172
|
+
}, 120000)
|
|
185
173
|
}
|
|
186
174
|
|
|
187
175
|
useEffect(() => {
|
|
176
|
+
if (!businessesList?.loading) {
|
|
177
|
+
const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
|
|
178
|
+
const ary = [];
|
|
179
|
+
while (fb.length > 0) {
|
|
180
|
+
ary.push(fb.splice(0, 2));
|
|
181
|
+
}
|
|
182
|
+
setFeaturedBusinesses(ary);
|
|
183
|
+
}
|
|
188
184
|
resetInactivityTimeout()
|
|
189
185
|
}, [businessesList.loading])
|
|
190
186
|
|
|
@@ -207,27 +203,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
207
203
|
})
|
|
208
204
|
}, [orderState?.options?.address?.location])
|
|
209
205
|
|
|
210
|
-
useEffect(() => {
|
|
211
|
-
const onFocusApp = (nextAppState: any) => {
|
|
212
|
-
if (
|
|
213
|
-
appState.current.match(/inactive|background/) &&
|
|
214
|
-
nextAppState === "active"
|
|
215
|
-
) {
|
|
216
|
-
getBusinesses(true);
|
|
217
|
-
}
|
|
218
|
-
appState.current = nextAppState;
|
|
219
|
-
setAppStateVisible(appState.current);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
AppState.addEventListener("change", onFocusApp);
|
|
223
|
-
return () => {
|
|
224
|
-
AppState.removeEventListener('change', onFocusApp);
|
|
225
|
-
};
|
|
226
|
-
}, [])
|
|
227
|
-
|
|
228
206
|
useFocusEffect(
|
|
229
207
|
useCallback(() => {
|
|
230
|
-
getBusinesses(true)
|
|
231
208
|
resetInactivityTimeout()
|
|
232
209
|
return () => clearTimeout(timerId.current)
|
|
233
210
|
}, [navigation])
|
|
@@ -288,25 +265,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
288
265
|
style={{ marginStart: 8 }}
|
|
289
266
|
/>
|
|
290
267
|
</WrapMomentOption>
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
268
|
+
{isPreOrderSetting && (
|
|
269
|
+
<WrapMomentOption
|
|
270
|
+
onPress={() => handleMomentClick()}>
|
|
271
|
+
<OText
|
|
272
|
+
size={12}
|
|
273
|
+
numberOfLines={1}
|
|
274
|
+
ellipsizeMode="tail"
|
|
275
|
+
color={theme.colors.textSecondary}>
|
|
276
|
+
{orderState.options?.momentß
|
|
277
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
278
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
279
|
+
</OText>
|
|
280
|
+
{isPreorderEnabled && (
|
|
281
|
+
<OIcon
|
|
282
|
+
src={theme.images.general.arrow_down}
|
|
283
|
+
width={10}
|
|
284
|
+
style={{ marginStart: 8 }}
|
|
285
|
+
/>
|
|
286
|
+
)}
|
|
287
|
+
</WrapMomentOption>
|
|
288
|
+
)}
|
|
310
289
|
|
|
311
290
|
{!businessId && (
|
|
312
291
|
<SearchBar
|
|
@@ -338,7 +317,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
338
317
|
{
|
|
339
318
|
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
340
319
|
<FeaturedWrapper>
|
|
341
|
-
<OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('
|
|
320
|
+
<OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
|
|
342
321
|
<ScrollView
|
|
343
322
|
showsHorizontalScrollIndicator={false}
|
|
344
323
|
nestedScrollEnabled
|
|
@@ -401,6 +380,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
401
380
|
handleCustomClick={handleBusinessClick}
|
|
402
381
|
orderType={orderState?.options?.type}
|
|
403
382
|
navigation={navigation}
|
|
383
|
+
businessHeader={business?.header}
|
|
384
|
+
businessFeatured={business?.featured}
|
|
385
|
+
businessLogo={business?.logo}
|
|
386
|
+
businessReviews={business?.reviews}
|
|
387
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
388
|
+
businessDeliveryTime={business?.delivery_time}
|
|
389
|
+
businessPickupTime={business?.pickup_time}
|
|
390
|
+
businessDistance={business?.distance}
|
|
404
391
|
/>
|
|
405
392
|
)
|
|
406
393
|
)}
|
|
@@ -24,6 +24,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
|
24
24
|
import { TaxInformation } from '../TaxInformation';
|
|
25
25
|
import { CartStoresListing } from '../CartStoresListing';
|
|
26
26
|
import { OAlert } from '../../../../../src/components/shared'
|
|
27
|
+
import { PlaceSpot } from '../PlaceSpot'
|
|
27
28
|
|
|
28
29
|
const CartUI = (props: any) => {
|
|
29
30
|
const {
|
|
@@ -54,12 +55,14 @@ const CartUI = (props: any) => {
|
|
|
54
55
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
55
56
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
56
57
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
58
|
+
const [openPlaceModal, setOpenPlaceModal] = useState(false)
|
|
57
59
|
|
|
58
60
|
const isCartPending = cart?.status === 2
|
|
59
61
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
60
62
|
|
|
61
63
|
const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
|
|
62
64
|
const businessId = business?.business_id ?? null
|
|
65
|
+
const placeSpotTypes = [3, 4]
|
|
63
66
|
|
|
64
67
|
const momentFormatted = !orderState?.option?.moment
|
|
65
68
|
? t('RIGHT_NOW', 'Right Now')
|
|
@@ -353,6 +356,24 @@ const CartUI = (props: any) => {
|
|
|
353
356
|
</OText>
|
|
354
357
|
</OSTable>
|
|
355
358
|
</OSTotal>
|
|
359
|
+
{placeSpotTypes.includes(orderState?.options?.type) && (
|
|
360
|
+
<OSTable style={{ marginTop: 15 }}>
|
|
361
|
+
<OText size={14} lineHeight={21} weight={'600'}>
|
|
362
|
+
{t('SPOT', 'Spot')}: {cart?.place?.name || t('NO_SELECTED', 'No selected')}
|
|
363
|
+
</OText>
|
|
364
|
+
<TouchableOpacity onPress={() => setOpenPlaceModal(true)}>
|
|
365
|
+
<OText
|
|
366
|
+
size={14}
|
|
367
|
+
lineHeight={21}
|
|
368
|
+
weight={'600'}
|
|
369
|
+
color={theme.colors.primary}
|
|
370
|
+
style={{ textDecorationLine: 'underline' }}
|
|
371
|
+
>
|
|
372
|
+
{t('EDIT', 'Edit')}
|
|
373
|
+
</OText>
|
|
374
|
+
</TouchableOpacity>
|
|
375
|
+
</OSTable>
|
|
376
|
+
)}
|
|
356
377
|
{cart?.status !== 2 && (
|
|
357
378
|
<OSTable>
|
|
358
379
|
<View style={{ width: '100%', marginTop: 20 }}>
|
|
@@ -425,8 +446,6 @@ const CartUI = (props: any) => {
|
|
|
425
446
|
open={openTaxModal.open}
|
|
426
447
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
427
448
|
entireModal
|
|
428
|
-
title={`${openTaxModal.data?.name ||
|
|
429
|
-
t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
|
|
430
449
|
>
|
|
431
450
|
<TaxInformation
|
|
432
451
|
type={openTaxModal.type}
|
|
@@ -434,14 +453,26 @@ const CartUI = (props: any) => {
|
|
|
434
453
|
products={cart?.products}
|
|
435
454
|
/>
|
|
436
455
|
</OModal>
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
456
|
+
<OModal
|
|
457
|
+
open={openPlaceModal}
|
|
458
|
+
title={t('CHOOSE_YOUR_SPOT', 'Choose your spot')}
|
|
459
|
+
onClose={() => setOpenPlaceModal(false)}
|
|
460
|
+
entireModal
|
|
461
|
+
>
|
|
462
|
+
<PlaceSpot
|
|
463
|
+
cart={cart}
|
|
464
|
+
isOpenPlaceSpot={openPlaceModal}
|
|
465
|
+
setOpenPlaceModal={setOpenPlaceModal}
|
|
444
466
|
/>
|
|
467
|
+
</OModal>
|
|
468
|
+
<OAlert
|
|
469
|
+
open={confirm.open}
|
|
470
|
+
title={confirm.title}
|
|
471
|
+
content={confirm.content}
|
|
472
|
+
onAccept={confirm.handleOnAccept}
|
|
473
|
+
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
474
|
+
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
475
|
+
/>
|
|
445
476
|
</CContainer>
|
|
446
477
|
)
|
|
447
478
|
}
|
|
@@ -22,9 +22,9 @@ export const CartContent = (props: any) => {
|
|
|
22
22
|
<CCContainer>
|
|
23
23
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
24
24
|
<>
|
|
25
|
-
<OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
|
|
25
|
+
{/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
|
|
26
26
|
{carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
|
|
27
|
-
</OText>
|
|
27
|
+
</OText> */}
|
|
28
28
|
{carts.map((cart: any, i: number) => (
|
|
29
29
|
<CCList key={i} style={{ overflow: 'visible' }}>
|
|
30
30
|
{cart.products.length > 0 && (
|
|
@@ -39,7 +39,8 @@ import {
|
|
|
39
39
|
ChCart,
|
|
40
40
|
DeliveryOptionsContainer,
|
|
41
41
|
DeliveryOptionItem,
|
|
42
|
-
WalletPaymentOptionContainer
|
|
42
|
+
WalletPaymentOptionContainer,
|
|
43
|
+
CartHeader
|
|
43
44
|
} from './styles';
|
|
44
45
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
45
46
|
|
|
@@ -131,10 +132,11 @@ const CheckoutUI = (props: any) => {
|
|
|
131
132
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
132
133
|
const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
|
|
133
134
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
|
|
136
|
+
const placeSpotTypes = [3, 4]
|
|
136
137
|
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
|
|
137
138
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
139
|
+
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place)
|
|
138
140
|
|
|
139
141
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
140
142
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -155,7 +157,7 @@ const CheckoutUI = (props: any) => {
|
|
|
155
157
|
navigation.navigate('MomentOption')
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
|
-
|
|
160
|
+
|
|
159
161
|
const handlePlaceOrder = () => {
|
|
160
162
|
if (!userErrors.length) {
|
|
161
163
|
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
@@ -200,8 +202,8 @@ const CheckoutUI = (props: any) => {
|
|
|
200
202
|
if (
|
|
201
203
|
!user?.cellphone &&
|
|
202
204
|
((validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
203
|
-
|
|
204
|
-
|
|
205
|
+
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
206
|
+
configs?.verification_phone_required?.value === '1')
|
|
205
207
|
) {
|
|
206
208
|
errors.push(t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone number is required'))
|
|
207
209
|
}
|
|
@@ -251,8 +253,8 @@ const CheckoutUI = (props: any) => {
|
|
|
251
253
|
isVertical
|
|
252
254
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
253
255
|
title={t('CHECKOUT', 'Checkout')}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
+
titleStyle={{ marginLeft: 0, marginRight: 0, paddingLeft: 40 }}
|
|
257
|
+
btnStyle={{ marginLeft: 40, padding: 40 }}
|
|
256
258
|
/>
|
|
257
259
|
<ChContainer style={styles.pagePadding}>
|
|
258
260
|
<ChSection style={{ paddingTop: 0 }}>
|
|
@@ -267,15 +269,15 @@ const CheckoutUI = (props: any) => {
|
|
|
267
269
|
/>
|
|
268
270
|
</CHMomentWrapper>
|
|
269
271
|
<CHMomentWrapper
|
|
270
|
-
|
|
271
|
-
|
|
272
|
+
onPress={() => handleMomentClick()}
|
|
273
|
+
disabled={loading}
|
|
272
274
|
>
|
|
273
275
|
<OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
|
|
274
276
|
{options?.moment
|
|
275
277
|
? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
276
278
|
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
277
279
|
</OText>
|
|
278
|
-
{
|
|
280
|
+
{isPreOrder && (
|
|
279
281
|
<OIcon
|
|
280
282
|
src={theme.images.general.arrow_down}
|
|
281
283
|
width={10}
|
|
@@ -544,17 +546,17 @@ const CheckoutUI = (props: any) => {
|
|
|
544
546
|
onNavigationRedirect={onNavigationRedirect}
|
|
545
547
|
paySelected={paymethodSelected}
|
|
546
548
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
547
|
-
handlePlaceOrder={handlePlaceOrder}
|
|
548
549
|
/>
|
|
549
550
|
</ChPaymethods>
|
|
550
551
|
</ChSection>
|
|
551
552
|
)}
|
|
552
553
|
|
|
553
|
-
{!cartState.loading && cart && isWalletEnabled && (
|
|
554
|
+
{!cartState.loading && cart && isWalletEnabled && businessDetails?.business?.configs && (
|
|
554
555
|
<WalletPaymentOptionContainer>
|
|
555
556
|
<PaymentOptionWallet
|
|
556
557
|
cart={cart}
|
|
557
558
|
businessId={cart?.business_id}
|
|
559
|
+
businessConfigs={businessDetails?.business?.configs}
|
|
558
560
|
/>
|
|
559
561
|
</WalletPaymentOptionContainer>
|
|
560
562
|
)}
|
|
@@ -570,9 +572,28 @@ const CheckoutUI = (props: any) => {
|
|
|
570
572
|
/>
|
|
571
573
|
) : (
|
|
572
574
|
<>
|
|
573
|
-
<
|
|
574
|
-
|
|
575
|
-
|
|
575
|
+
<CartHeader>
|
|
576
|
+
<OText
|
|
577
|
+
size={16}
|
|
578
|
+
lineHeight={24}
|
|
579
|
+
color={theme.colors.textNormal}
|
|
580
|
+
style={{ fontWeight: '500' }}
|
|
581
|
+
>
|
|
582
|
+
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
583
|
+
</OText>
|
|
584
|
+
<TouchableOpacity
|
|
585
|
+
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
586
|
+
>
|
|
587
|
+
<OText
|
|
588
|
+
size={10}
|
|
589
|
+
lineHeight={15}
|
|
590
|
+
color={theme.colors.primary}
|
|
591
|
+
style={{ textDecorationLine: 'underline' }}
|
|
592
|
+
>
|
|
593
|
+
{t('ADD_PRODUCTS', 'Add products')}
|
|
594
|
+
</OText>
|
|
595
|
+
</TouchableOpacity>
|
|
596
|
+
</CartHeader>
|
|
576
597
|
{props.isFranchiseApp && (
|
|
577
598
|
<TouchableOpacity
|
|
578
599
|
onPress={() => setOpenChangeStore(true)}
|
|
@@ -628,6 +649,14 @@ const CheckoutUI = (props: any) => {
|
|
|
628
649
|
{t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')}
|
|
629
650
|
</OText>
|
|
630
651
|
)}
|
|
652
|
+
{placeSpotTypes.includes(options?.type) && !cart?.place && (
|
|
653
|
+
<OText
|
|
654
|
+
color={theme.colors.error}
|
|
655
|
+
size={12}
|
|
656
|
+
>
|
|
657
|
+
{t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
|
|
658
|
+
</OText>
|
|
659
|
+
)}
|
|
631
660
|
</ChErrors>
|
|
632
661
|
</View>
|
|
633
662
|
)}
|
|
@@ -647,8 +676,8 @@ const CheckoutUI = (props: any) => {
|
|
|
647
676
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
648
677
|
<FloatingButton
|
|
649
678
|
handleClick={() => handlePlaceOrder()}
|
|
650
|
-
isSecondaryBtn={
|
|
651
|
-
disabled={
|
|
679
|
+
isSecondaryBtn={isDisabledButtonPlace}
|
|
680
|
+
disabled={isDisabledButtonPlace}
|
|
652
681
|
btnText={cart?.subtotal >= cart?.minimum
|
|
653
682
|
? (
|
|
654
683
|
placing
|
|
@@ -676,19 +705,6 @@ const CheckoutUI = (props: any) => {
|
|
|
676
705
|
setShowGateway={setShowGateway}
|
|
677
706
|
/>
|
|
678
707
|
)}
|
|
679
|
-
{webviewPaymethod?.gateway === 'square' && showGateway.open && (
|
|
680
|
-
<PaymentOptionsWebView
|
|
681
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
682
|
-
uri={`https://test-square-f50f7.web.app`}
|
|
683
|
-
user={user}
|
|
684
|
-
token={token}
|
|
685
|
-
cart={cart}
|
|
686
|
-
currency={currency}
|
|
687
|
-
webviewPaymethod={webviewPaymethod}
|
|
688
|
-
setShowGateway={setShowGateway}
|
|
689
|
-
locationId={'L1NGAY5M6KJRX'}
|
|
690
|
-
/>
|
|
691
|
-
)}
|
|
692
708
|
</>
|
|
693
709
|
)
|
|
694
710
|
}
|
|
@@ -105,3 +105,10 @@ export const DeliveryOptionItem = styled.View`
|
|
|
105
105
|
flex-direction: row;
|
|
106
106
|
background-color: ${(props : any) => props?.backgroundColor ?? '#fff'};
|
|
107
107
|
`;
|
|
108
|
+
|
|
109
|
+
export const CartHeader = styled.View`
|
|
110
|
+
align-items: center;
|
|
111
|
+
flex-direction: row;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
margin-bottom: 10px;
|
|
114
|
+
`
|
|
@@ -63,7 +63,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
63
63
|
return (
|
|
64
64
|
<DTContainer>
|
|
65
65
|
<DTWrapperTips>
|
|
66
|
-
{driverTipsOptions.map((option: any, i: number) => (
|
|
66
|
+
{driverTipsOptions.map((option: any, i: number) => (
|
|
67
67
|
<TouchableOpacity
|
|
68
68
|
key={i}
|
|
69
69
|
onPress={() => handlerChangeOption(option)}
|
|
@@ -65,18 +65,6 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
65
65
|
}
|
|
66
66
|
}, [formState])
|
|
67
67
|
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (Object.keys(errors).length > 0) {
|
|
70
|
-
// Convert all errors in one string to show in toast provider
|
|
71
|
-
const list = Object.values(errors)
|
|
72
|
-
let stringError = ''
|
|
73
|
-
list.map((item: any, i: number) => {
|
|
74
|
-
stringError += (i + 1) === list.length ? `- ${item.message}` : `- ${item.message}\n`
|
|
75
|
-
})
|
|
76
|
-
showToast(ToastType.Error, stringError)
|
|
77
|
-
}
|
|
78
|
-
}, [errors])
|
|
79
|
-
|
|
80
68
|
return (
|
|
81
69
|
<Container>
|
|
82
70
|
<NavBar
|
|
@@ -100,6 +88,14 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
100
88
|
{t('FORGOT_PASSWORD_TEXT_MESSAGE', "Enter your email address and we'll sent a link to reset your password.")}
|
|
101
89
|
</OText>
|
|
102
90
|
<FormInput>
|
|
91
|
+
{errors?.email && (
|
|
92
|
+
<OText
|
|
93
|
+
size={14}
|
|
94
|
+
color={theme.colors.danger5}
|
|
95
|
+
weight={'normal'}>
|
|
96
|
+
{errors?.email?.message}{errors?.email?.type === 'required' && '*'}
|
|
97
|
+
</OText>
|
|
98
|
+
)}
|
|
103
99
|
<Controller
|
|
104
100
|
control={control}
|
|
105
101
|
render={({ onChange, value }: any) => (
|