ordering-ui-react-native 0.12.35 → 0.12.39
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 +1 -1
- package/src/components/AddressForm/index.tsx +5 -5
- package/src/components/FacebookLogin/index.tsx +2 -2
- package/src/components/LoginForm/index.tsx +1 -1
- package/src/components/PaymentOptions/index.tsx +5 -5
- package/src/components/SignupForm/index.tsx +2 -2
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -8
- package/themes/business/src/components/LoginForm/index.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -4
- package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -108
- package/themes/business/src/components/SearchBar/index.tsx +1 -1
- package/themes/business/src/components/SignupForm/index.tsx +2 -2
- package/themes/business/src/types/index.tsx +3 -3
- package/themes/doordash/src/components/AddressForm/index.tsx +5 -5
- package/themes/doordash/src/components/FacebookLogin/index.tsx +2 -2
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -1
- package/themes/doordash/src/components/PaymentOptions/index.tsx +5 -5
- package/themes/doordash/src/components/SignupForm/index.tsx +2 -2
- package/themes/franchises/src/components/AddressForm/index.tsx +5 -5
- package/themes/franchises/src/components/FacebookLogin/index.tsx +2 -2
- package/themes/franchises/src/components/LoginForm/index.tsx +1 -1
- package/themes/franchises/src/components/PaymentOptions/index.tsx +3 -3
- package/themes/franchises/src/components/SignupForm/index.tsx +2 -2
- package/themes/instacart/src/components/AddressForm/index.tsx +5 -5
- package/themes/instacart/src/components/FacebookLogin/index.tsx +2 -2
- package/themes/instacart/src/components/LoginForm/index.tsx +1 -1
- package/themes/instacart/src/components/PaymentOptions/index.tsx +4 -4
- package/themes/instacart/src/components/SignupForm/index.tsx +2 -2
- package/themes/original/src/components/AddressForm/index.tsx +5 -5
- package/themes/original/src/components/FacebookLogin/index.tsx +2 -2
- package/themes/original/src/components/LoginForm/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +5 -5
- package/themes/original/src/components/SignupForm/index.tsx +2 -2
- package/themes/single-business/src/components/AddressForm/index.tsx +5 -5
- package/themes/single-business/src/components/AppleLogin/index.tsx +2 -2
- package/themes/single-business/src/components/FacebookLogin/index.tsx +2 -2
- package/themes/single-business/src/components/GoogleLogin/index.tsx +2 -2
- package/themes/single-business/src/components/LanguageSelector/index.tsx +87 -70
- package/themes/single-business/src/components/LoginForm/index.tsx +1 -1
- package/themes/single-business/src/components/OrderDetails/index.tsx +14 -14
- package/themes/single-business/src/components/PaymentOptions/index.tsx +4 -4
- package/themes/single-business/src/components/ProductForm/index.tsx +682 -656
- package/themes/single-business/src/components/ProductForm/styles.tsx +1 -1
- package/themes/single-business/src/components/SignupForm/index.tsx +2 -2
- package/themes/single-business/src/components/UserProfile/index.tsx +2 -2
- package/themes/single-business/src/components/shared/OInput.tsx +1 -0
- package/themes/single-business/src/components/shared/OLink.tsx +80 -0
- package/themes/single-business/src/components/shared/index.tsx +2 -0
- package/themes/single-business/src/types/index.tsx +1 -0
- package/themes/uber-eats/src/components/AddressForm/index.tsx +5 -5
- package/themes/uber-eats/src/components/FacebookLogin/index.tsx +2 -2
- package/themes/uber-eats/src/components/LoginForm/index.tsx +1 -1
- package/themes/uber-eats/src/components/PaymentOptions/index.tsx +5 -5
- package/themes/uber-eats/src/components/SignupForm/index.tsx +2 -2
|
@@ -425,7 +425,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
425
425
|
forwardRef={(ref: any) => handleRefs(ref, field.code)}
|
|
426
426
|
onSubmitEditing={() =>
|
|
427
427
|
field.code === 'email'
|
|
428
|
-
? phoneRef
|
|
428
|
+
? phoneRef?.current?.focus?.()
|
|
429
429
|
: handleFocusRef(getNextFieldCode(i))
|
|
430
430
|
}
|
|
431
431
|
/>
|
|
@@ -445,7 +445,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
445
445
|
forwardRef={phoneRef}
|
|
446
446
|
textInputProps={{
|
|
447
447
|
returnKeyType: 'next',
|
|
448
|
-
onSubmitEditing: () => passwordRef
|
|
448
|
+
onSubmitEditing: () => passwordRef?.current?.focus?.(),
|
|
449
449
|
}}
|
|
450
450
|
/>
|
|
451
451
|
</View>
|
|
@@ -130,7 +130,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
return (
|
|
133
|
-
<View style={{ flex: 1, height: height - top - bottom -
|
|
133
|
+
<View style={{ flex: 1, height: height - top - bottom - 80 }}>
|
|
134
134
|
<OText size={24} color={theme.colors.textNormal} lineHeight={36} weight={Platform.OS === 'ios' ? '600' : 'bold'} style={{ marginTop: 14, marginBottom: 24, ...styles.pagePadding }}>{t('PROFILE', 'Profile')}</OText>
|
|
135
135
|
<CenterView style={styles.pagePadding}>
|
|
136
136
|
<View style={styles.photo}>
|
|
@@ -167,7 +167,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
167
167
|
</Actions>
|
|
168
168
|
|
|
169
169
|
<Actions>
|
|
170
|
-
<LanguageSelector iconColor={theme.colors.textNormal} pickerStyle={langPickerStyle} />
|
|
170
|
+
<LanguageSelector iconColor={theme.colors.textNormal} pickerStyle={langPickerStyle} allowLoading />
|
|
171
171
|
<View style={{ height: 17 }} />
|
|
172
172
|
<LogoutButton color={theme.colors.textNormal} text={t('LOGOUT', 'Logout')} />
|
|
173
173
|
</Actions>
|
|
@@ -74,6 +74,7 @@ const OInput = (props: Props): React.ReactElement => {
|
|
|
74
74
|
<Input
|
|
75
75
|
name={props.name}
|
|
76
76
|
secureTextEntry={props.isSecured}
|
|
77
|
+
numberOfLines={props.numberOfLines}
|
|
77
78
|
onChangeText={(txt: any) => props.name ? props.onChange({ target: { name: props.name, value: txt } }) : props.onChange(txt)}
|
|
78
79
|
defaultValue={props.value}
|
|
79
80
|
placeholder={props.placeholder ? props.placeholder : ''}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Alert, Linking, Pressable, TextStyle } from 'react-native';
|
|
3
|
+
import { useLanguage } from 'ordering-components/native';
|
|
4
|
+
import OText from './OText';
|
|
5
|
+
import OButton from './OButton';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
url: string | undefined;
|
|
9
|
+
shorcut?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
PressStyle?: TextStyle;
|
|
12
|
+
TextStyle?: TextStyle;
|
|
13
|
+
type?: string;
|
|
14
|
+
hasButton?: boolean;
|
|
15
|
+
children?: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const OLink = (props: Props): React.ReactElement => {
|
|
19
|
+
const { url, shorcut, color, PressStyle, TextStyle, type, hasButton, children } = props;
|
|
20
|
+
const [, t] = useLanguage();
|
|
21
|
+
|
|
22
|
+
const handleAlert = () =>
|
|
23
|
+
Alert.alert(
|
|
24
|
+
t('ERROR_OPENING_THE_LINK', 'Error opening the link'),
|
|
25
|
+
t('LINK_UNSUPPORTED', 'Link could not be opened or is not supported'),
|
|
26
|
+
[
|
|
27
|
+
{
|
|
28
|
+
text: t('OK', 'Ok'),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const handleOpenUrl = async (breakFunction = false) => {
|
|
34
|
+
if(breakFunction) {
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
if (!url) {
|
|
38
|
+
handleAlert();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
const supported = await Linking.canOpenURL(url);
|
|
44
|
+
|
|
45
|
+
if (supported) {
|
|
46
|
+
await Linking.openURL(url);
|
|
47
|
+
} else {
|
|
48
|
+
handleAlert();
|
|
49
|
+
}
|
|
50
|
+
} catch (err) {
|
|
51
|
+
handleAlert();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Pressable style={PressStyle} onPress={() => handleOpenUrl(hasButton)}>
|
|
57
|
+
{children}
|
|
58
|
+
{!children && (
|
|
59
|
+
hasButton ? (
|
|
60
|
+
<OButton
|
|
61
|
+
onClick={() => handleOpenUrl()}
|
|
62
|
+
text={shorcut} imgRightSrc=''
|
|
63
|
+
textStyle={{color: 'white'}}
|
|
64
|
+
style={{width: '100%', alignSelf: 'center', borderRadius: 10}}
|
|
65
|
+
/>
|
|
66
|
+
) : (
|
|
67
|
+
<OText
|
|
68
|
+
style={TextStyle}
|
|
69
|
+
numberOfLines={1}
|
|
70
|
+
ellipsizeMode="tail"
|
|
71
|
+
color={color}>
|
|
72
|
+
{shorcut}
|
|
73
|
+
</OText>
|
|
74
|
+
)
|
|
75
|
+
)}
|
|
76
|
+
</Pressable>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default OLink;
|
|
@@ -7,6 +7,7 @@ import OIconButton from './OIconButton'
|
|
|
7
7
|
import OIconText from './OIconText'
|
|
8
8
|
import OInput from './OInput'
|
|
9
9
|
import OKeyButton from './OKeyButton'
|
|
10
|
+
import OLink from './OLink'
|
|
10
11
|
import OModal from './OModal'
|
|
11
12
|
import OText from './OText'
|
|
12
13
|
import OTextarea from './OTextarea'
|
|
@@ -24,6 +25,7 @@ export {
|
|
|
24
25
|
OTextarea,
|
|
25
26
|
OToggle,
|
|
26
27
|
OKeyButton,
|
|
28
|
+
OLink,
|
|
27
29
|
OAlert,
|
|
28
30
|
OModal,
|
|
29
31
|
OBottomPopup,
|
|
@@ -523,7 +523,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
523
523
|
}
|
|
524
524
|
setIsFirstTime(false)
|
|
525
525
|
},
|
|
526
|
-
onSubmitEditing: () => internalNumberRef
|
|
526
|
+
onSubmitEditing: () => internalNumberRef?.current?.focus?.(),
|
|
527
527
|
autoCorrect: false,
|
|
528
528
|
blurOnSubmit: false,
|
|
529
529
|
returnKeyType: 'next'
|
|
@@ -576,7 +576,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
576
576
|
control={control}
|
|
577
577
|
name='internal_number'
|
|
578
578
|
rules={{ required: isRequiredField && isRequiredField('internal_number') ? t(`VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`, `The field internal number is required`) : null }}
|
|
579
|
-
defaultValue={address?.internal_number || formState.changes?.internal_number || addressState
|
|
579
|
+
defaultValue={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
|
|
580
580
|
render={() => (
|
|
581
581
|
<OInput
|
|
582
582
|
name='internal_number'
|
|
@@ -585,11 +585,11 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
585
585
|
handleChangeInput(text)
|
|
586
586
|
setValue('internal_number', text)
|
|
587
587
|
}}
|
|
588
|
-
value={address?.internal_number || formState.changes?.internal_number || addressState
|
|
588
|
+
value={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
|
|
589
589
|
style={styles.inputsStyle}
|
|
590
590
|
forwardRef={internalNumberRef}
|
|
591
591
|
returnKeyType='next'
|
|
592
|
-
onSubmitEditing={() => zipCodeRef
|
|
592
|
+
onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
|
|
593
593
|
blurOnSubmit={false}
|
|
594
594
|
/>
|
|
595
595
|
)}
|
|
@@ -617,7 +617,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
617
617
|
style={styles.inputsStyle}
|
|
618
618
|
forwardRef={zipCodeRef}
|
|
619
619
|
returnKeyType='next'
|
|
620
|
-
onSubmitEditing={() => addressNotesRef
|
|
620
|
+
onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
|
|
621
621
|
blurOnSubmit={false}
|
|
622
622
|
/>
|
|
623
623
|
)}
|
|
@@ -26,7 +26,7 @@ export const FacebookLogin = (props: any) => {
|
|
|
26
26
|
: t('LOGIN_WITH_FACEBOOK', 'Login with Facebook');
|
|
27
27
|
|
|
28
28
|
const logoutWithFacebook = () => {
|
|
29
|
-
LoginManager.logOut();
|
|
29
|
+
LoginManager && LoginManager.logOut();
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const handleLoginClick = async (accessToken: string) => {
|
|
@@ -57,7 +57,7 @@ export const FacebookLogin = (props: any) => {
|
|
|
57
57
|
|
|
58
58
|
const loginWithFacebook = () => {
|
|
59
59
|
handleLoading && handleLoading(true)
|
|
60
|
-
LoginManager.logInWithPermissions(['public_profile']).then(
|
|
60
|
+
LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
|
|
61
61
|
(login: any) => {
|
|
62
62
|
if (login.isCancelled) {
|
|
63
63
|
const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
|
|
@@ -288,7 +288,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
288
288
|
handleData={(val: any) => setPhoneInputData(val)}
|
|
289
289
|
textInputProps={{
|
|
290
290
|
returnKeyType: 'next',
|
|
291
|
-
onSubmitEditing: () => inputRef
|
|
291
|
+
onSubmitEditing: () => inputRef?.current?.focus?.(),
|
|
292
292
|
}}
|
|
293
293
|
/>
|
|
294
294
|
</View>
|
|
@@ -195,7 +195,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
195
195
|
showsVerticalScrollIndicator={false}
|
|
196
196
|
data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id).filter((p: any) => !excludeIds.includes(p.id))}
|
|
197
197
|
renderItem={renderPaymethods}
|
|
198
|
-
keyExtractor={(paymethod: any) => paymethod
|
|
198
|
+
keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
|
|
199
199
|
ListFooterComponent={renderFooter}
|
|
200
200
|
/>
|
|
201
201
|
)}
|
|
@@ -228,7 +228,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
228
228
|
/>
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
{isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData
|
|
231
|
+
{isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
|
|
232
232
|
<View>
|
|
233
233
|
<OButton
|
|
234
234
|
text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
|
|
@@ -333,7 +333,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
333
333
|
<OModal
|
|
334
334
|
entireModal
|
|
335
335
|
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
336
|
-
open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData
|
|
336
|
+
open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
|
|
337
337
|
onClose={() => handlePaymethodClick(null)}
|
|
338
338
|
>
|
|
339
339
|
<KeyboardAvoidingView
|
|
@@ -351,7 +351,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
351
351
|
</OModal>
|
|
352
352
|
|
|
353
353
|
{/* Stripe Connect */}
|
|
354
|
-
{isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData
|
|
354
|
+
{isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
|
|
355
355
|
<View>
|
|
356
356
|
<OButton
|
|
357
357
|
text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
|
|
@@ -417,7 +417,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
417
417
|
{/* Paypal */}
|
|
418
418
|
{/* <Modal
|
|
419
419
|
className='modal-info'
|
|
420
|
-
open={paymethodSelected?.gateway === 'paypal' && !paymethodData
|
|
420
|
+
open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
|
|
421
421
|
onClose={() => handlePaymethodClick(null)}
|
|
422
422
|
title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
|
|
423
423
|
>
|
|
@@ -370,7 +370,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
370
370
|
returnKeyType='next'
|
|
371
371
|
blurOnSubmit={false}
|
|
372
372
|
forwardRef={(ref : any) => handleRefs(ref,field.code)}
|
|
373
|
-
onSubmitEditing={() => field.code === 'email' ? phoneRef
|
|
373
|
+
onSubmitEditing={() => field.code === 'email' ? phoneRef?.current?.focus?.() : handleFocusRef(getNextFieldCode(i))}
|
|
374
374
|
/>
|
|
375
375
|
)}
|
|
376
376
|
name={field.code}
|
|
@@ -393,7 +393,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
393
393
|
forwardRef={phoneRef}
|
|
394
394
|
textInputProps={{
|
|
395
395
|
returnKeyType: 'next',
|
|
396
|
-
onSubmitEditing: () => passwordRef
|
|
396
|
+
onSubmitEditing: () => passwordRef?.current?.focus?.()
|
|
397
397
|
}}
|
|
398
398
|
/>
|
|
399
399
|
</View>
|