ordering-ui-react-native 0.21.71 → 0.21.72-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/PaymentOptionsWebView/index.tsx +1 -0
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +3 -1
- package/themes/business/index.tsx +4 -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/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/Chat/index.tsx +3 -1
- package/themes/business/src/components/DriverMap/index.tsx +44 -27
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- 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 +74 -24
- package/themes/business/src/components/OrderDetails/Business.tsx +63 -7
- package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -20
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +110 -40
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -35
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderSummary/index.tsx +240 -76
- package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
- package/themes/business/src/components/OrdersOption/index.tsx +250 -127
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +28 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +105 -53
- package/themes/business/src/components/WebsocketStatus/index.tsx +4 -4
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +21 -4
- package/themes/business/src/utils/index.tsx +19 -1
- 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 +13 -1
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- 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/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
- package/themes/original/src/components/BusinessController/index.tsx +12 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +15 -4
- 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/index.tsx +1 -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 +39 -12
- package/themes/original/src/components/CartContent/index.tsx +59 -44
- package/themes/original/src/components/Checkout/index.tsx +60 -29
- 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/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- 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/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- 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 +2 -10
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +1 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/MomentOption/index.tsx +13 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +123 -62
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
- package/themes/original/src/components/MyOrders/index.tsx +21 -26
- package/themes/original/src/components/NavBar/index.tsx +4 -2
- 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 +1 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
- package/themes/original/src/components/OrderDetails/index.tsx +28 -12
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderSummary/index.tsx +23 -5
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +2 -4
- 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 +46 -5
- 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 +16 -19
- package/themes/original/src/components/ProductForm/index.tsx +108 -105
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +8 -1
- 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 +65 -67
- package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
- 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 +10 -35
- package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
- 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/UserFormDetails/index.tsx +83 -84
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +8 -7
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -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,
|
|
@@ -33,7 +33,12 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
33
33
|
placeByMethodPay,
|
|
34
34
|
methodPaySupported,
|
|
35
35
|
setPlaceByMethodPay,
|
|
36
|
-
cartTotal
|
|
36
|
+
cartTotal,
|
|
37
|
+
publicKeyAddCard,
|
|
38
|
+
urlscheme,
|
|
39
|
+
androidAppId,
|
|
40
|
+
businessNames,
|
|
41
|
+
setNewCardAdded
|
|
37
42
|
} = props;
|
|
38
43
|
|
|
39
44
|
const theme = useTheme();
|
|
@@ -52,6 +57,7 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
52
57
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
53
58
|
const zipCodeEnabled = validationFields?.fields?.card?.zipcode?.enabled
|
|
54
59
|
const zipCodeRequired = validationFields?.fields?.card?.zipcode?.required
|
|
60
|
+
const isToSave = methodsPay?.includes(paymethod) ? publicKeyState?.key : (publicKeyAddCard || publicKeyState?.key)
|
|
55
61
|
const styles = StyleSheet.create({
|
|
56
62
|
container: {
|
|
57
63
|
width: '100%',
|
|
@@ -145,6 +151,10 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
145
151
|
const _isNewCard = index === 0
|
|
146
152
|
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId, _isNewCard);
|
|
147
153
|
})
|
|
154
|
+
setNewCardAdded?.({
|
|
155
|
+
...card,
|
|
156
|
+
id: setupIntent?.paymentMethodId
|
|
157
|
+
})
|
|
148
158
|
} else {
|
|
149
159
|
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
|
|
150
160
|
}
|
|
@@ -197,69 +207,79 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
197
207
|
|
|
198
208
|
return (
|
|
199
209
|
<View style={{ ...styles.container, height: methodsPay?.includes(paymethod) ? 'auto' : height - top - bottom - 60 - (isKeyboardShow ? 250 : 0) }}>
|
|
200
|
-
{
|
|
201
|
-
<
|
|
202
|
-
<
|
|
203
|
-
|
|
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
|
-
|
|
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
|
+
) : (
|
|
242
272
|
<ErrorMessage>
|
|
243
273
|
<OText
|
|
244
274
|
size={20}
|
|
245
275
|
color={theme.colors.error}
|
|
246
|
-
style={{ marginTop: 20
|
|
276
|
+
style={{ marginTop: 20 }}
|
|
247
277
|
>
|
|
248
|
-
{
|
|
278
|
+
{t('SOMETHING_WRONG', 'Something is wrong!')}
|
|
249
279
|
</OText>
|
|
250
280
|
</ErrorMessage>
|
|
251
281
|
)}
|
|
252
|
-
|
|
253
|
-
) : (
|
|
254
|
-
<ErrorMessage>
|
|
255
|
-
<OText
|
|
256
|
-
size={20}
|
|
257
|
-
color={theme.colors.error}
|
|
258
|
-
style={{ marginTop: 20 }}
|
|
259
|
-
>
|
|
260
|
-
{t('SOMETHING_WRONG', 'Something is wrong!')}
|
|
261
|
-
</OText>
|
|
262
|
-
</ErrorMessage>
|
|
282
|
+
</>
|
|
263
283
|
)}
|
|
264
284
|
{!methodsPay?.includes(paymethod) && (
|
|
265
285
|
<OButton
|
|
@@ -267,7 +287,6 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
267
287
|
bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
|
|
268
288
|
borderColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
|
|
269
289
|
style={styles.btnAddStyle}
|
|
270
|
-
textStyle={{ color: 'white' }}
|
|
271
290
|
imgRightSrc={null}
|
|
272
291
|
onClick={() => handleSaveCard()}
|
|
273
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>
|
|
@@ -304,93 +304,97 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
304
304
|
{sortInputFields({
|
|
305
305
|
values: validationFields.fields?.checkout,
|
|
306
306
|
}).map(
|
|
307
|
-
(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
<
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
{
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
.
|
|
343
|
-
.replace(
|
|
344
|
-
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
345
|
-
'',
|
|
346
|
-
),
|
|
347
|
-
);
|
|
348
|
-
field.code !== 'email'
|
|
349
|
-
? handleChangeInput(val)
|
|
350
|
-
: handleChangeInput({
|
|
351
|
-
target: {
|
|
352
|
-
name: 'email',
|
|
353
|
-
value: val.target.value
|
|
307
|
+
(item: any) => {
|
|
308
|
+
const field = item?.validation_field || item
|
|
309
|
+
return (showField &&
|
|
310
|
+
showField(field.code) && ((requiredFields && requiredFields?.includes?.(field.code)) || !requiredFields) && (
|
|
311
|
+
<React.Fragment key={field.id}>
|
|
312
|
+
<Controller
|
|
313
|
+
key={field.id}
|
|
314
|
+
control={control}
|
|
315
|
+
render={() => (
|
|
316
|
+
<>
|
|
317
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
|
|
318
|
+
{t(field?.code?.toUpperCase(), field?.name)}
|
|
319
|
+
</OText>
|
|
320
|
+
<OInput
|
|
321
|
+
name={field.code}
|
|
322
|
+
placeholder={t(
|
|
323
|
+
field.code.toUpperCase(),
|
|
324
|
+
field?.name,
|
|
325
|
+
)}
|
|
326
|
+
inputStyle={styles.inputStyle}
|
|
327
|
+
style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
|
|
328
|
+
autoCapitalize={
|
|
329
|
+
field.code === 'email' ? 'none' : 'sentences'
|
|
330
|
+
}
|
|
331
|
+
isDisabled={false}
|
|
332
|
+
value={
|
|
333
|
+
formState?.changes[field.code] ??
|
|
334
|
+
(user && user[field.code]) ??
|
|
335
|
+
''
|
|
336
|
+
}
|
|
337
|
+
onChange={(val: any) => {
|
|
338
|
+
field.code !== 'email'
|
|
339
|
+
? setValue(field.code, val.target.value)
|
|
340
|
+
: setValue(
|
|
341
|
+
field.code,
|
|
342
|
+
val.target.value
|
|
354
343
|
.toLowerCase()
|
|
355
344
|
.replace(
|
|
356
345
|
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
357
346
|
'',
|
|
358
347
|
),
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
348
|
+
);
|
|
349
|
+
field.code !== 'email'
|
|
350
|
+
? handleChangeInput(val)
|
|
351
|
+
: handleChangeInput({
|
|
352
|
+
target: {
|
|
353
|
+
name: 'email',
|
|
354
|
+
value: val.target.value
|
|
355
|
+
.toLowerCase()
|
|
356
|
+
.replace(
|
|
357
|
+
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
358
|
+
'',
|
|
359
|
+
),
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
}}
|
|
363
|
+
autoCorrect={field.code === 'email' && false}
|
|
364
|
+
type={
|
|
365
|
+
field.code === 'email'
|
|
366
|
+
? 'email-address'
|
|
367
|
+
: 'default'
|
|
368
|
+
}
|
|
369
|
+
returnKeyType="done"
|
|
370
|
+
autoCompleteType={
|
|
371
|
+
field.code === 'email' ? 'email' : 'off'
|
|
372
|
+
}
|
|
373
|
+
/>
|
|
374
|
+
</>
|
|
375
|
+
)}
|
|
376
|
+
name={field.code}
|
|
377
|
+
rules={getInputRules(field)}
|
|
378
|
+
defaultValue={user && user[field.code]}
|
|
379
|
+
/>
|
|
380
|
+
</React.Fragment>
|
|
381
|
+
))
|
|
382
|
+
},
|
|
381
383
|
)}
|
|
382
384
|
{showInputBirthday && (
|
|
383
|
-
|
|
384
|
-
<
|
|
385
|
-
{
|
|
386
|
-
|
|
387
|
-
<TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
|
|
388
|
-
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ marginTop: 6, marginBottom: -15 }}>
|
|
389
|
-
{birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
|
|
385
|
+
<>
|
|
386
|
+
<WrapperBirthdate>
|
|
387
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
|
|
388
|
+
{t('BIRTHDATE', 'Birthdate')}
|
|
390
389
|
</OText>
|
|
391
|
-
|
|
390
|
+
<TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
|
|
391
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ marginTop: 6 }}>
|
|
392
|
+
{birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
|
|
393
|
+
</OText>
|
|
394
|
+
</TouchableOpacity>
|
|
395
|
+
</WrapperBirthdate>
|
|
392
396
|
<DatePickerUI open={showDatePicker} birthdate={birthdate} onConfirm={_handleChangeDate} onCancel={() => setShowDatePicker(false)} />
|
|
393
|
-
|
|
397
|
+
</>
|
|
394
398
|
)}
|
|
395
399
|
{!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
|
|
396
400
|
<WrapperPhone>
|
|
@@ -480,9 +484,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
480
484
|
? t('UPDATING', 'Updating...')
|
|
481
485
|
: t('UPDATE', 'Update')
|
|
482
486
|
}
|
|
483
|
-
|
|
484
|
-
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
485
|
-
borderColor={theme.colors.primary}
|
|
487
|
+
textStyle={{ fontSize: 14 }}
|
|
486
488
|
isDisabled={formState.loading}
|
|
487
489
|
imgRightSrc={null}
|
|
488
490
|
style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
|
|
@@ -500,12 +502,10 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
500
502
|
? t('SIGN_UP_AND_PLACE_ORDER', 'Sign up and place order')
|
|
501
503
|
: t('CONTINUE', 'Continue'))
|
|
502
504
|
}
|
|
503
|
-
bgColor={theme.colors.primary}
|
|
504
505
|
textStyle={{
|
|
505
506
|
color: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.primary : theme.colors.white,
|
|
506
507
|
fontSize: 14
|
|
507
508
|
}}
|
|
508
|
-
borderColor={theme.colors.primary}
|
|
509
509
|
isDisabled={!user?.guest_id && (formState.loading || !isValid)}
|
|
510
510
|
imgRightSrc={null}
|
|
511
511
|
style={{
|
|
@@ -552,4 +552,3 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
552
552
|
</>
|
|
553
553
|
);
|
|
554
554
|
};
|
|
555
|
-
|
|
@@ -20,7 +20,7 @@ import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
|
20
20
|
import FontAwesome from 'react-native-vector-icons/FontAwesome'
|
|
21
21
|
import FastImage from 'react-native-fast-image'
|
|
22
22
|
import { OAlert } from '../../../../../src/components/shared'
|
|
23
|
-
|
|
23
|
+
import { WebsocketStatus } from '../WebsocketStatus'
|
|
24
24
|
import {
|
|
25
25
|
OIcon,
|
|
26
26
|
OText,
|
|
@@ -44,6 +44,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
44
44
|
handleRemoveAccount,
|
|
45
45
|
removeAccountState,
|
|
46
46
|
handleChangePromotions,
|
|
47
|
+
appVersion
|
|
47
48
|
} = props;
|
|
48
49
|
|
|
49
50
|
const theme = useTheme();
|
|
@@ -151,7 +152,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
151
152
|
const detailProps = {
|
|
152
153
|
goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
|
|
153
154
|
onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params),
|
|
154
|
-
handleRemoveAccount
|
|
155
|
+
handleRemoveAccount,
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
useEffect(() => {
|
|
@@ -270,6 +271,14 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
270
271
|
<View style={{ height: 17 }} />
|
|
271
272
|
</Actions>
|
|
272
273
|
</ListWrap>
|
|
274
|
+
<WebsocketStatus />
|
|
275
|
+
{appVersion && (
|
|
276
|
+
<View
|
|
277
|
+
style={{ alignItems: 'center' }}
|
|
278
|
+
>
|
|
279
|
+
<OText>v{appVersion}</OText>
|
|
280
|
+
</View>
|
|
281
|
+
)}
|
|
273
282
|
<OAlert
|
|
274
283
|
open={confirm.open}
|
|
275
284
|
title={confirm.title}
|
|
@@ -141,6 +141,11 @@ const WalletsUI = (props: any) => {
|
|
|
141
141
|
btnStyle={{ paddingLeft: 0 }}
|
|
142
142
|
isVertical={!hideWalletsTheme}
|
|
143
143
|
hideArrowLeft={!hideWalletsTheme}
|
|
144
|
+
buttonProps={{
|
|
145
|
+
bgColor: theme.colors.white,
|
|
146
|
+
borderColor: theme.colors.white,
|
|
147
|
+
textStyle: { color: theme.colors.btnFont }
|
|
148
|
+
}}
|
|
144
149
|
/>
|
|
145
150
|
{isChewLayout && !openHistory && (
|
|
146
151
|
<OButton
|
|
@@ -304,13 +309,11 @@ const WalletsUI = (props: any) => {
|
|
|
304
309
|
borderWidth: 0,
|
|
305
310
|
width: 26,
|
|
306
311
|
height: 26,
|
|
307
|
-
backgroundColor: '#FFF',
|
|
308
|
-
borderColor: '#FFF',
|
|
309
|
-
shadowColor: '#FFF',
|
|
310
312
|
paddingLeft: 0,
|
|
311
313
|
paddingRight: 0,
|
|
312
314
|
marginBottom: 10
|
|
313
315
|
}}
|
|
316
|
+
useArrow
|
|
314
317
|
onClick={() => setOpenHistory(false)}
|
|
315
318
|
icon={AntDesignIcon}
|
|
316
319
|
iconProps={{
|