ordering-ui-react-native 0.22.21 → 0.22.22-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 +6 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +40 -39
- package/src/components/StripeMethodForm/index.tsx +4 -2
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/types/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +49 -26
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +36 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +38 -19
- package/themes/business/src/components/OrderDetails/Business.tsx +47 -27
- package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +128 -41
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +45 -18
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +6 -4
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +217 -156
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +39 -16
- package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +162 -174
- package/themes/business/src/components/PrinterSettings/styles.tsx +14 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +55 -22
- package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/config/currency.tsx +1010 -0
- package/themes/business/src/hooks/useLocation.tsx +16 -12
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +16 -4
- package/themes/business/src/utils/index.tsx +33 -3
- 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/Checkout/index.tsx +6 -0
- 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/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +11 -0
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +46 -28
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
- package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +10 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +46 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -4
- package/themes/original/src/components/Checkout/index.tsx +127 -77
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +3 -11
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +12 -9
- package/themes/original/src/components/MessageListing/index.tsx +2 -1
- package/themes/original/src/components/Messages/index.tsx +27 -19
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +80 -51
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
- package/themes/original/src/components/MyOrders/index.tsx +2 -2
- package/themes/original/src/components/NavBar/index.tsx +7 -4
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +16 -11
- package/themes/original/src/components/OrderDetails/index.tsx +44 -21
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -3
- package/themes/original/src/components/OrderSummary/index.tsx +29 -10
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +3 -6
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +4 -3
- package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +50 -43
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +0 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +102 -88
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -5
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +16 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +76 -62
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +164 -135
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/UserVerification/index.tsx +15 -4
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/types/index.tsx +10 -3
- package/themes/original/src/utils/index.tsx +30 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -26,12 +26,14 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
26
26
|
const {
|
|
27
27
|
onSelectCard,
|
|
28
28
|
deleteCard,
|
|
29
|
-
cardSelected,
|
|
30
29
|
cardsList,
|
|
31
30
|
handleCardClick,
|
|
32
31
|
onOpen,
|
|
33
32
|
gateway,
|
|
34
|
-
paySelected
|
|
33
|
+
paySelected,
|
|
34
|
+
newCardAdded,
|
|
35
|
+
addNewCardAsDefault,
|
|
36
|
+
setUserHasCards
|
|
35
37
|
} = props;
|
|
36
38
|
|
|
37
39
|
const theme = useTheme();
|
|
@@ -55,6 +57,17 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
55
57
|
}
|
|
56
58
|
}, [cardsList?.loading])
|
|
57
59
|
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (newCardAdded && addNewCardAsDefault) {
|
|
62
|
+
handleCardSelected(newCardAdded)
|
|
63
|
+
}
|
|
64
|
+
}, [JSON.stringify(newCardAdded)])
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const hasCardSelected = cardsList?.cards?.some?.((card : any) => card?.id === paySelected?.data?.id)
|
|
68
|
+
setUserHasCards && setUserHasCards(cardsList?.cards?.length > 0 && hasCardSelected)
|
|
69
|
+
}, [cardsList?.cards?.length, paySelected])
|
|
70
|
+
|
|
58
71
|
return (
|
|
59
72
|
<>
|
|
60
73
|
{token && !cardsList.loading && cardsList.cards && cardsList.cards.length === 0 && (
|
|
@@ -96,7 +109,7 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
96
109
|
<OSItem key={card.id} isUnique={cardsList.cards.length} isInvalid={!card?.zipcode && validateZipcodeCard}>
|
|
97
110
|
<OSItemContent onPress={() => handleCardSelected(card)}>
|
|
98
111
|
<View style={styles.viewStyle}>
|
|
99
|
-
{(card.id ===
|
|
112
|
+
{(card.id === paySelected?.data?.id) ? (
|
|
100
113
|
<OIcon
|
|
101
114
|
src={theme.images.general.radio_act}
|
|
102
115
|
width={16}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@stripe/stripe-react-native';
|
|
10
10
|
import { useTheme } from 'styled-components/native';
|
|
11
11
|
import { ErrorMessage } from './styles';
|
|
12
|
-
|
|
12
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
13
13
|
import { StripeElementsForm as StripeFormController } from './naked';
|
|
14
14
|
import { OButton, OText } from '../shared';
|
|
15
15
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -17,7 +17,7 @@ import { StripeMethodForm } from '../../../../../src/components/StripeMethodForm
|
|
|
17
17
|
|
|
18
18
|
const StripeElementsFormUI = (props: any) => {
|
|
19
19
|
const {
|
|
20
|
-
|
|
20
|
+
publicKeyState,
|
|
21
21
|
handleSource,
|
|
22
22
|
values,
|
|
23
23
|
businessId,
|
|
@@ -35,8 +35,10 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
35
35
|
setPlaceByMethodPay,
|
|
36
36
|
cartTotal,
|
|
37
37
|
publicKeyAddCard,
|
|
38
|
-
|
|
39
|
-
androidAppId
|
|
38
|
+
urlscheme,
|
|
39
|
+
androidAppId,
|
|
40
|
+
businessNames,
|
|
41
|
+
setNewCardAdded
|
|
40
42
|
} = props;
|
|
41
43
|
|
|
42
44
|
const theme = useTheme();
|
|
@@ -55,7 +57,7 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
55
57
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
56
58
|
const zipCodeEnabled = validationFields?.fields?.card?.zipcode?.enabled
|
|
57
59
|
const zipCodeRequired = validationFields?.fields?.card?.zipcode?.required
|
|
58
|
-
const isToSave = methodsPay?.includes(paymethod) ?
|
|
60
|
+
const isToSave = methodsPay?.includes(paymethod) ? publicKeyState?.key : (publicKeyAddCard || publicKeyState?.key)
|
|
59
61
|
const styles = StyleSheet.create({
|
|
60
62
|
container: {
|
|
61
63
|
width: '100%',
|
|
@@ -149,6 +151,10 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
149
151
|
const _isNewCard = index === 0
|
|
150
152
|
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId, _isNewCard);
|
|
151
153
|
})
|
|
154
|
+
setNewCardAdded?.({
|
|
155
|
+
...card,
|
|
156
|
+
id: setupIntent?.paymentMethodId
|
|
157
|
+
})
|
|
152
158
|
} else {
|
|
153
159
|
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
|
|
154
160
|
}
|
|
@@ -201,70 +207,79 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
201
207
|
|
|
202
208
|
return (
|
|
203
209
|
<View style={{ ...styles.container, height: methodsPay?.includes(paymethod) ? 'auto' : height - top - bottom - 60 - (isKeyboardShow ? 250 : 0) }}>
|
|
204
|
-
{
|
|
205
|
-
<
|
|
206
|
-
<
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
{
|
|
212
|
-
<
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
210
|
+
{publicKeyState.loading ? (
|
|
211
|
+
<Placeholder Animation={Fade}>
|
|
212
|
+
<PlaceholderLine height={50} style={{ marginTop: 20 }} />
|
|
213
|
+
</Placeholder>
|
|
214
|
+
) : (
|
|
215
|
+
<>
|
|
216
|
+
{publicKeyState?.key ? (
|
|
217
|
+
<View style={{ flex: 1 }}>
|
|
218
|
+
<StripeProvider
|
|
219
|
+
publishableKey={isToSave}
|
|
220
|
+
merchantIdentifier={merchantId}
|
|
221
|
+
urlscheme={`${urlscheme}://checkout/${cart?.uuid}`}
|
|
222
|
+
>
|
|
223
|
+
{methodsPay?.includes(paymethod) ? (
|
|
224
|
+
<StripeMethodForm
|
|
225
|
+
handleSource={handleSource}
|
|
226
|
+
onCancel={onCancel}
|
|
227
|
+
cart={cart}
|
|
228
|
+
cartTotal={cartTotal}
|
|
229
|
+
setErrors={setErrors}
|
|
230
|
+
paymethod={paymethod}
|
|
231
|
+
devMode={publicKeyState?.key?.includes('test')}
|
|
232
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
233
|
+
placeByMethodPay={placeByMethodPay}
|
|
234
|
+
methodPaySupported={methodPaySupported}
|
|
235
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
236
|
+
androidAppId={androidAppId}
|
|
237
|
+
businessNames={businessNames}
|
|
238
|
+
/>
|
|
239
|
+
) : (
|
|
240
|
+
<CardField
|
|
241
|
+
postalCodeEnabled={zipCodeEnabled}
|
|
242
|
+
cardStyle={{
|
|
243
|
+
backgroundColor: '#FFFFFF',
|
|
244
|
+
textColor: '#000000',
|
|
245
|
+
borderWidth: 1,
|
|
246
|
+
borderRadius: 8,
|
|
247
|
+
borderColor: theme.colors.border
|
|
248
|
+
}}
|
|
249
|
+
style={{
|
|
250
|
+
width: '100%',
|
|
251
|
+
height: 50,
|
|
252
|
+
marginVertical: 30,
|
|
253
|
+
zIndex: 9999,
|
|
254
|
+
}}
|
|
255
|
+
onCardChange={(cardDetails: any) => setCard(cardDetails)}
|
|
256
|
+
/>
|
|
257
|
+
)}
|
|
258
|
+
</StripeProvider>
|
|
259
|
+
{!!errors && (
|
|
260
|
+
<ErrorMessage>
|
|
261
|
+
<OText
|
|
262
|
+
size={20}
|
|
263
|
+
color={theme.colors.error}
|
|
264
|
+
style={{ marginTop: 20, textAlign: 'center' }}
|
|
265
|
+
>
|
|
266
|
+
{errors}
|
|
267
|
+
</OText>
|
|
268
|
+
</ErrorMessage>
|
|
269
|
+
)}
|
|
270
|
+
</View>
|
|
271
|
+
) : (
|
|
247
272
|
<ErrorMessage>
|
|
248
273
|
<OText
|
|
249
274
|
size={20}
|
|
250
275
|
color={theme.colors.error}
|
|
251
|
-
style={{ marginTop: 20
|
|
276
|
+
style={{ marginTop: 20 }}
|
|
252
277
|
>
|
|
253
|
-
{
|
|
278
|
+
{t('SOMETHING_WRONG', 'Something is wrong!')}
|
|
254
279
|
</OText>
|
|
255
280
|
</ErrorMessage>
|
|
256
281
|
)}
|
|
257
|
-
|
|
258
|
-
) : (
|
|
259
|
-
<ErrorMessage>
|
|
260
|
-
<OText
|
|
261
|
-
size={20}
|
|
262
|
-
color={theme.colors.error}
|
|
263
|
-
style={{ marginTop: 20 }}
|
|
264
|
-
>
|
|
265
|
-
{t('SOMETHING_WRONG', 'Something is wrong!')}
|
|
266
|
-
</OText>
|
|
267
|
-
</ErrorMessage>
|
|
282
|
+
</>
|
|
268
283
|
)}
|
|
269
284
|
{!methodsPay?.includes(paymethod) && (
|
|
270
285
|
<OButton
|
|
@@ -272,7 +287,6 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
272
287
|
bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
|
|
273
288
|
borderColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
|
|
274
289
|
style={styles.btnAddStyle}
|
|
275
|
-
textStyle={{ color: 'white' }}
|
|
276
290
|
imgRightSrc={null}
|
|
277
291
|
onClick={() => handleSaveCard()}
|
|
278
292
|
isDisabled={!isCompleted}
|
|
@@ -13,6 +13,7 @@ export const StripeElementsForm = (props: any) => {
|
|
|
13
13
|
const [ordering] = useApi();
|
|
14
14
|
const [{ token }] = useSession();
|
|
15
15
|
const [state, setState] = useState({ loading: false, loadingAdd: false, error: null, requirements: null });
|
|
16
|
+
const [publicKeyState, setPublicKeyState] = useState({ key: props.publicKey, loading: true, error: null })
|
|
16
17
|
|
|
17
18
|
const getRequirements = async () => {
|
|
18
19
|
try {
|
|
@@ -52,7 +53,7 @@ export const StripeElementsForm = (props: any) => {
|
|
|
52
53
|
const result = await fetch(`${ordering.root}/payments/stripe/cards`, {
|
|
53
54
|
method: 'POST',
|
|
54
55
|
headers: {
|
|
55
|
-
Authorization: `Bearer ${
|
|
56
|
+
Authorization: `Bearer ${token}`,
|
|
56
57
|
'Content-Type': 'application/json'
|
|
57
58
|
},
|
|
58
59
|
body: JSON.stringify({
|
|
@@ -85,6 +86,51 @@ export const StripeElementsForm = (props: any) => {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Method to get stripe credentials from API
|
|
91
|
+
*/
|
|
92
|
+
const getCredentials = async () => {
|
|
93
|
+
try {
|
|
94
|
+
setPublicKeyState({
|
|
95
|
+
...publicKeyState,
|
|
96
|
+
loading: true
|
|
97
|
+
})
|
|
98
|
+
const { content: { result, error } } = await ordering.setAccessToken(token).paymentCards().getCredentials()
|
|
99
|
+
if (!error) {
|
|
100
|
+
setPublicKeyState({
|
|
101
|
+
loading: false,
|
|
102
|
+
key: result.publishable,
|
|
103
|
+
error: null
|
|
104
|
+
})
|
|
105
|
+
} else {
|
|
106
|
+
setPublicKeyState({
|
|
107
|
+
...publicKeyState,
|
|
108
|
+
loading: false,
|
|
109
|
+
error: result
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
} catch (error) {
|
|
113
|
+
setPublicKeyState({
|
|
114
|
+
...publicKeyState,
|
|
115
|
+
loading: false,
|
|
116
|
+
error: error.message
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (!token) return
|
|
123
|
+
if (props.publicKey) {
|
|
124
|
+
setPublicKeyState({
|
|
125
|
+
loading: false,
|
|
126
|
+
key: props.publicKey,
|
|
127
|
+
error: null
|
|
128
|
+
})
|
|
129
|
+
} else {
|
|
130
|
+
getCredentials()
|
|
131
|
+
}
|
|
132
|
+
}, [token, props.publicKey])
|
|
133
|
+
|
|
88
134
|
useEffect(() => {
|
|
89
135
|
if (!token || state.requirements) return
|
|
90
136
|
toSave && getRequirements()
|
|
@@ -96,6 +142,7 @@ export const StripeElementsForm = (props: any) => {
|
|
|
96
142
|
values={state}
|
|
97
143
|
requirements={state.requirements}
|
|
98
144
|
stripeTokenHandler={stripeTokenHandler}
|
|
145
|
+
publicKeyState={publicKeyState}
|
|
99
146
|
/>
|
|
100
147
|
)
|
|
101
148
|
}
|
|
@@ -138,9 +138,6 @@ const StripeRedirectFormUI = (props: any) => {
|
|
|
138
138
|
<OButton
|
|
139
139
|
// text={formState.isSubmitting ? t('LOADING', 'Loading...') : t('OK', 'OK')}
|
|
140
140
|
text={t('OK', 'OK')}
|
|
141
|
-
bgColor={theme.colors.primary}
|
|
142
|
-
borderColor={theme.colors.primary}
|
|
143
|
-
textStyle={{ color: 'white' }}
|
|
144
141
|
imgRightSrc={null}
|
|
145
142
|
// isDisabled={formState.isSubmitting}
|
|
146
143
|
// onClick={() => handleSubmit(onSubmit)}
|
|
@@ -14,7 +14,8 @@ interface taxInformationParams {
|
|
|
14
14
|
percentage?: number,
|
|
15
15
|
id: number,
|
|
16
16
|
discounts?: any,
|
|
17
|
-
rate_type?: number
|
|
17
|
+
rate_type?: number,
|
|
18
|
+
target?: string
|
|
18
19
|
},
|
|
19
20
|
products: Array<any>,
|
|
20
21
|
type: string
|
|
@@ -34,7 +35,7 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
34
35
|
const offersHideArray = ['offer_target_2', 'offer_target_3']
|
|
35
36
|
const hideProductsSectionOffers = offersHideArray.includes(type)
|
|
36
37
|
const dataHideArray : Array<string | number> = ['platform', 'business']
|
|
37
|
-
const hideProductsSectionData = dataHideArray.includes(data.type)
|
|
38
|
+
const hideProductsSectionData = dataHideArray.includes(data.type) || data?.target === 'delivery_fee'
|
|
38
39
|
|
|
39
40
|
const getFilterValidation = (product: any) => {
|
|
40
41
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { Platform, StyleSheet, View } from 'react-native'
|
|
2
|
+
import { Platform, StyleSheet, View, Vibration } from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
useLanguage,
|
|
5
5
|
useOrder,
|
|
@@ -20,7 +20,7 @@ import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
|
20
20
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
21
21
|
import { UpsellingLayout } from './UpsellingLayout';
|
|
22
22
|
|
|
23
|
-
export const UpsellingContent = (props
|
|
23
|
+
export const UpsellingContent = (props: any) => {
|
|
24
24
|
const {
|
|
25
25
|
onGoBack,
|
|
26
26
|
handleUpsellingPage,
|
|
@@ -44,12 +44,10 @@ export const UpsellingContent = (props : any) => {
|
|
|
44
44
|
const commentDelayTime = isChewLayout ? 500 : null
|
|
45
45
|
|
|
46
46
|
const cartList = (carts && Object.values(carts).filter((_cart: any) => _cart?.products?.length > 0 && _cart.uuid !== cart?.uuid)) || []
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
const styles = StyleSheet.create({
|
|
49
49
|
closeUpsellingButton: {
|
|
50
50
|
borderRadius: 7.6,
|
|
51
|
-
borderColor: theme.colors.primary,
|
|
52
|
-
backgroundColor: theme.colors.primary,
|
|
53
51
|
borderWidth: 1,
|
|
54
52
|
alignSelf: 'center',
|
|
55
53
|
height: 44,
|
|
@@ -92,6 +90,11 @@ export const UpsellingContent = (props : any) => {
|
|
|
92
90
|
setShowTitle(contentOffset.y > 30)
|
|
93
91
|
}
|
|
94
92
|
|
|
93
|
+
const handleClickCheckout = () => {
|
|
94
|
+
Vibration.vibrate(100)
|
|
95
|
+
handleUpsellingPage(cart)
|
|
96
|
+
}
|
|
97
|
+
|
|
95
98
|
return (
|
|
96
99
|
<>
|
|
97
100
|
<View style={styles.wrapperNavbar}>
|
|
@@ -160,9 +163,9 @@ export const UpsellingContent = (props : any) => {
|
|
|
160
163
|
<OButton
|
|
161
164
|
imgRightSrc=''
|
|
162
165
|
text={t('CHECKOUT', 'Checkout')}
|
|
166
|
+
textStyle={{ fontSize: 14 }}
|
|
163
167
|
style={{ ...styles.closeUpsellingButton }}
|
|
164
|
-
|
|
165
|
-
onClick={() => handleUpsellingPage(cart)}
|
|
168
|
+
onClick={() => handleClickCheckout()}
|
|
166
169
|
/>
|
|
167
170
|
</View>
|
|
168
171
|
</>
|
|
@@ -25,6 +25,9 @@ export const UpsellingLayout = (props : any) => {
|
|
|
25
25
|
const [{ parsePrice }] = useUtils()
|
|
26
26
|
const [, t] = useLanguage()
|
|
27
27
|
|
|
28
|
+
const hideProductDummyLogo = theme?.business_view?.components?.products?.components?.product?.components?.dummy?.hidden
|
|
29
|
+
|
|
30
|
+
|
|
28
31
|
const styles = StyleSheet.create({
|
|
29
32
|
imageStyle: {
|
|
30
33
|
width: 73,
|
|
@@ -66,9 +69,11 @@ export const UpsellingLayout = (props : any) => {
|
|
|
66
69
|
<OText size={10} color={theme.colors.primary}>{t('ADD', 'Add')}</OText>
|
|
67
70
|
</AddButton>
|
|
68
71
|
</View>
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
+
{(product?.images || !hideProductDummyLogo) && (
|
|
73
|
+
<View>
|
|
74
|
+
<OIcon url={product?.images || theme?.images?.dummies?.product} style={styles.imageStyle} />
|
|
75
|
+
</View>
|
|
76
|
+
)}
|
|
72
77
|
</Item>
|
|
73
78
|
)) : (
|
|
74
79
|
<OText>
|
|
@@ -35,7 +35,8 @@ const UserDetailsUI = (props: any) => {
|
|
|
35
35
|
handleSendVerifyCode,
|
|
36
36
|
verifyPhoneState,
|
|
37
37
|
setFormState,
|
|
38
|
-
setIsOpen
|
|
38
|
+
setIsOpen,
|
|
39
|
+
isCheckoutPlace
|
|
39
40
|
} = props
|
|
40
41
|
|
|
41
42
|
const theme = useTheme();
|
|
@@ -95,23 +96,23 @@ const UserDetailsUI = (props: any) => {
|
|
|
95
96
|
},
|
|
96
97
|
});
|
|
97
98
|
handleSendVerifyCode({
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
cellphone: cellphone,
|
|
100
|
+
country_phone_code: countryPhoneCode
|
|
100
101
|
})
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
const handleSendPhoneCode = (values: any) => {
|
|
105
|
-
|
|
106
|
+
setWillVerifyOtpState(false)
|
|
106
107
|
setIsModalVisible(false)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
setFormState({
|
|
109
|
+
...formState,
|
|
110
|
+
changes: {
|
|
111
|
+
...formState?.changes,
|
|
112
|
+
verification_code: values?.code
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}
|
|
115
116
|
|
|
116
117
|
useEffect(() => {
|
|
117
118
|
if (willVerifyOtpState) handleVerifyCodeClick()
|
|
@@ -158,7 +159,7 @@ const UserDetailsUI = (props: any) => {
|
|
|
158
159
|
{t('CUSTOMER_DETAILS', 'Customer Details')}
|
|
159
160
|
</OText>
|
|
160
161
|
)}
|
|
161
|
-
{cartStatus !== 2 && !
|
|
162
|
+
{cartStatus !== 2 && !isCheckoutPlace && (
|
|
162
163
|
!isEdit ? (
|
|
163
164
|
<EditBtn onPress={() => toggleIsEdit()} activeOpacity={0.7}>
|
|
164
165
|
<OIcon
|
|
@@ -189,12 +190,12 @@ const UserDetailsUI = (props: any) => {
|
|
|
189
190
|
{userData?.name} {userData?.middle_name} {userData?.lastname} {userData?.second_lastname}
|
|
190
191
|
</OText>
|
|
191
192
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
192
|
-
{userData?.email}
|
|
193
|
+
{userData?.guest_id ? userData?.guest_email : userData?.email}
|
|
193
194
|
</OText>
|
|
194
|
-
{!!(userData?.cellphone || user?.cellphone) && (
|
|
195
|
+
{!!((userData?.cellphone ?? userData?.guest_cellphone) || (user?.cellphone ?? user?.guest_cellphone)) && (
|
|
195
196
|
<>
|
|
196
197
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
197
|
-
{(userData?.country_phone_code) && `+${(userData?.country_phone_code)} `}{(userData?.cellphone)}
|
|
198
|
+
{(userData?.country_phone_code) && `+${(userData?.country_phone_code)} `}{(userData?.guest_id ? user?.guest_cellphone : userData?.cellphone)}
|
|
198
199
|
</OText>
|
|
199
200
|
{!!phoneUpdate && (
|
|
200
201
|
<OText color={theme.colors.error} style={{ textAlign: 'center' }}>{t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number')}</OText>
|