ordering-ui-react-native 0.23.37 → 0.23.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/themes/original/src/components/AddressForm/index.tsx +3 -3
- package/themes/original/src/components/Checkout/index.tsx +20 -10
- package/themes/original/src/components/OrderDetails/index.tsx +2 -2
- package/themes/original/src/components/UserDetails/index.tsx +14 -14
- package/themes/original/src/components/UserFormDetails/index.tsx +8 -6
package/package.json
CHANGED
|
@@ -690,7 +690,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
690
690
|
)}
|
|
691
691
|
|
|
692
692
|
<View style={{ flexDirection: 'row', flexBasis: '50%' }}>
|
|
693
|
-
{((isRequiredField && isRequiredField('internal_number')) || showFieldWithTheme('internal_number')) && (
|
|
693
|
+
{showField?.('internal_number') && ((isRequiredField && isRequiredField('internal_number')) || showFieldWithTheme('internal_number')) && (
|
|
694
694
|
<Controller
|
|
695
695
|
control={control}
|
|
696
696
|
name="internal_number"
|
|
@@ -737,7 +737,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
737
737
|
/>
|
|
738
738
|
)}
|
|
739
739
|
|
|
740
|
-
{((isRequiredField && isRequiredField('zipcode')) || showFieldWithTheme('zipcode')) && (
|
|
740
|
+
{showField?.('zipcode') && ((isRequiredField && isRequiredField('zipcode')) || showFieldWithTheme('zipcode')) && (
|
|
741
741
|
<Controller
|
|
742
742
|
control={control}
|
|
743
743
|
name="zipcode"
|
|
@@ -782,7 +782,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
782
782
|
)}
|
|
783
783
|
</View>
|
|
784
784
|
|
|
785
|
-
{((isRequiredField && isRequiredField('address_notes')) || showFieldWithTheme('address_notes')) && (
|
|
785
|
+
{showField?.('address_notes') && ((isRequiredField && isRequiredField('address_notes')) || showFieldWithTheme('address_notes')) && (
|
|
786
786
|
<Controller
|
|
787
787
|
control={control}
|
|
788
788
|
name="address_notes"
|
|
@@ -180,11 +180,11 @@ const CheckoutUI = (props: any) => {
|
|
|
180
180
|
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
181
181
|
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
182
182
|
|
|
183
|
-
const checkoutFields = useMemo(() => checkoutFieldsState?.fields?.filter((field
|
|
184
|
-
const guestCheckoutDriveTip = useMemo(() => checkoutFields?.find((field
|
|
185
|
-
const guestCheckoutComment = useMemo(() => checkoutFields?.find((field
|
|
186
|
-
const guestCheckoutCoupon = useMemo(() => checkoutFields?.find((field
|
|
187
|
-
const guestCheckoutZipcode = useMemo(() => checkoutFields?.find((field
|
|
183
|
+
const checkoutFields = useMemo(() => checkoutFieldsState?.fields?.filter((field: any) => field.order_type_id === options?.type), [checkoutFieldsState, options])
|
|
184
|
+
const guestCheckoutDriveTip = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === 1 && field?.validation_field?.code === 'driver_tip'), [JSON.stringify(checkoutFields), options])
|
|
185
|
+
const guestCheckoutComment = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'comments'), [JSON.stringify(checkoutFields), options])
|
|
186
|
+
const guestCheckoutCoupon = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'coupon'), [JSON.stringify(checkoutFields), options])
|
|
187
|
+
const guestCheckoutZipcode = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'zipcode'), [JSON.stringify(checkoutFields), options])
|
|
188
188
|
|
|
189
189
|
const placeSpotTypes = [3, 4, 5]
|
|
190
190
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
@@ -212,7 +212,7 @@ const CheckoutUI = (props: any) => {
|
|
|
212
212
|
|
|
213
213
|
const validateCommentsCartField = (guestCheckoutComment?.enabled && (user?.guest_id ? guestCheckoutComment?.required_with_guest : guestCheckoutComment?.required)) && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
214
214
|
const validateDriverTipField = options.type === 1 && (guestCheckoutDriveTip?.enabled && (user?.guest_id ? guestCheckoutDriveTip?.required_with_guest : guestCheckoutDriveTip?.required)) && (Number(cart?.driver_tip) <= 0)
|
|
215
|
-
const validateCouponField = (guestCheckoutCoupon?.enabled && (user?.guest_id ? guestCheckoutCoupon?.required_with_guest : guestCheckoutCoupon?.required)) && !cart?.offers?.some((offer
|
|
215
|
+
const validateCouponField = (guestCheckoutCoupon?.enabled && (user?.guest_id ? guestCheckoutCoupon?.required_with_guest : guestCheckoutCoupon?.required)) && !cart?.offers?.some((offer: any) => offer?.type === 2)
|
|
216
216
|
const validateZipcodeCard = (guestCheckoutZipcode?.enabled && (user?.guest_id ? guestCheckoutZipcode?.required_with_guest : guestCheckoutZipcode?.required)) && paymethodSelected?.gateway === 'stripe' && paymethodSelected?.data?.card && !paymethodSelected?.data?.card?.zipcode
|
|
217
217
|
|
|
218
218
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
@@ -350,20 +350,30 @@ const CheckoutUI = (props: any) => {
|
|
|
350
350
|
const checkGuestValidationFields = () => {
|
|
351
351
|
const userSelected = user
|
|
352
352
|
const _requiredFields = checkoutFieldsState?.fields
|
|
353
|
-
.filter((field) => (field?.order_type_id === options?.type) && field?.enabled && field?.required_with_guest &&
|
|
353
|
+
.filter((field : any) => (field?.order_type_id === options?.type) && field?.enabled && field?.required_with_guest &&
|
|
354
354
|
!notFields.includes(field?.validation_field?.code) &&
|
|
355
|
+
field?.validation_field?.code !== 'email' &&
|
|
355
356
|
userSelected && !userSelected[field?.validation_field?.code])
|
|
356
|
-
const requiredFieldsCode = _requiredFields.map((item) => item?.validation_field?.code)
|
|
357
|
-
const guestCheckoutCellPhone = checkoutFieldsState?.fields?.find((field) => field.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
|
|
357
|
+
const requiredFieldsCode = _requiredFields.map((item : any) => item?.validation_field?.code)
|
|
358
|
+
const guestCheckoutCellPhone = checkoutFieldsState?.fields?.find((field : any) => field.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
|
|
359
|
+
const guestCheckoutEmail = checkoutFieldsState?.fields?.find((field : any) => field.order_type_id === options?.type && field?.validation_field?.code === 'email')
|
|
358
360
|
if (
|
|
359
361
|
userSelected &&
|
|
360
|
-
!userSelected?.
|
|
362
|
+
!userSelected?.guest_cellphone &&
|
|
361
363
|
((guestCheckoutCellPhone?.enabled &&
|
|
362
364
|
guestCheckoutCellPhone?.required_with_guest) ||
|
|
363
365
|
configs?.verification_phone_required?.value === '1')
|
|
364
366
|
) {
|
|
365
367
|
requiredFieldsCode.push('cellphone')
|
|
366
368
|
}
|
|
369
|
+
if (
|
|
370
|
+
userSelected &&
|
|
371
|
+
!userSelected?.guest_email &&
|
|
372
|
+
guestCheckoutEmail?.enabled &&
|
|
373
|
+
guestCheckoutEmail?.required_with_guest
|
|
374
|
+
) {
|
|
375
|
+
requiredFieldsCode.push('email')
|
|
376
|
+
}
|
|
367
377
|
setRequiredFields(requiredFieldsCode)
|
|
368
378
|
}
|
|
369
379
|
|
|
@@ -713,13 +713,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
713
713
|
{order?.customer?.address}
|
|
714
714
|
</OText>
|
|
715
715
|
)}
|
|
716
|
-
{(!!order?.customer?.cellphone && !hideCustomerPhone) && (
|
|
716
|
+
{(!!(order?.customer?.cellphone || order?.customer?.guest_cellphone) && !hideCustomerPhone) && (
|
|
717
717
|
<OText
|
|
718
718
|
size={12}
|
|
719
719
|
lineHeight={18}
|
|
720
720
|
color={theme.colors.textNormal}
|
|
721
721
|
mBottom={2}>
|
|
722
|
-
{`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
|
|
722
|
+
{`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.guest_id ? order?.customer?.guest_cellphone : order?.customer?.cellphone}`}
|
|
723
723
|
</OText>
|
|
724
724
|
)}
|
|
725
725
|
</InfoBlock>
|
|
@@ -96,23 +96,23 @@ const UserDetailsUI = (props: any) => {
|
|
|
96
96
|
},
|
|
97
97
|
});
|
|
98
98
|
handleSendVerifyCode({
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
cellphone: cellphone,
|
|
100
|
+
country_phone_code: countryPhoneCode
|
|
101
101
|
})
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
const handleSendPhoneCode = (values: any) => {
|
|
106
|
-
|
|
106
|
+
setWillVerifyOtpState(false)
|
|
107
107
|
setIsModalVisible(false)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
setFormState({
|
|
109
|
+
...formState,
|
|
110
|
+
changes: {
|
|
111
|
+
...formState?.changes,
|
|
112
|
+
verification_code: values?.code
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
116
|
|
|
117
117
|
useEffect(() => {
|
|
118
118
|
if (willVerifyOtpState) handleVerifyCodeClick()
|
|
@@ -190,12 +190,12 @@ const UserDetailsUI = (props: any) => {
|
|
|
190
190
|
{userData?.name} {userData?.middle_name} {userData?.lastname} {userData?.second_lastname}
|
|
191
191
|
</OText>
|
|
192
192
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
193
|
-
{userData?.email}
|
|
193
|
+
{userData?.guest_id ? userData?.guest_email : userData?.email}
|
|
194
194
|
</OText>
|
|
195
|
-
{!!(userData?.cellphone || user?.cellphone) && (
|
|
195
|
+
{!!((userData?.cellphone ?? userData?.guest_cellphone) || (user?.cellphone ?? user?.guest_cellphone)) && (
|
|
196
196
|
<>
|
|
197
197
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
198
|
-
{(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)}
|
|
199
199
|
</OText>
|
|
200
200
|
{!!phoneUpdate && (
|
|
201
201
|
<OText color={theme.colors.error} style={{ textAlign: 'center' }}>{t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number')}</OText>
|
|
@@ -134,7 +134,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
const cellphoneValue = () => {
|
|
137
|
-
let cellphone = user?.
|
|
137
|
+
let cellphone = user?.guest_id ? user?.guest_cellphone : user?.cellphone
|
|
138
138
|
if (cellphone && CONDITIONAL_CODES.includes(user?.country_code)) {
|
|
139
139
|
if (user?.country_code === 'PR') {
|
|
140
140
|
cellphone = user?.cellphone?.slice(3)
|
|
@@ -148,10 +148,12 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
148
148
|
setUserPhoneNumber(userPhoneNumber);
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
const cellphone = user?.guest_id ? user?.guest_cellphone : user?.cellphone
|
|
152
|
+
|
|
153
|
+
if (cellphone) {
|
|
152
154
|
let phone = null;
|
|
153
155
|
if (user?.country_phone_code) {
|
|
154
|
-
phone = `+${user?.country_phone_code} ${
|
|
156
|
+
phone = `+${user?.country_phone_code} ${cellphone}`;
|
|
155
157
|
} else {
|
|
156
158
|
phone = user?.cellphone;
|
|
157
159
|
}
|
|
@@ -165,7 +167,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
165
167
|
});
|
|
166
168
|
return;
|
|
167
169
|
}
|
|
168
|
-
setUserPhoneNumber(
|
|
170
|
+
setUserPhoneNumber(cellphone || '');
|
|
169
171
|
};
|
|
170
172
|
|
|
171
173
|
const onSubmit = () => {
|
|
@@ -351,7 +353,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
351
353
|
isDisabled={false}
|
|
352
354
|
value={
|
|
353
355
|
formState?.changes[field.code] ??
|
|
354
|
-
(user && user[field.code]) ??
|
|
356
|
+
(user && user?.guest_id ? user?.guest_email : user[field.code]) ??
|
|
355
357
|
''
|
|
356
358
|
}
|
|
357
359
|
onChange={(val: any) => {
|
|
@@ -395,7 +397,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
395
397
|
)}
|
|
396
398
|
name={field.code}
|
|
397
399
|
rules={getInputRules(field)}
|
|
398
|
-
defaultValue={user && user[field.code]}
|
|
400
|
+
defaultValue={user && (field.code === 'email' && user?.guest_id ? user?.guest_email : user[field.code])}
|
|
399
401
|
/>
|
|
400
402
|
</React.Fragment>
|
|
401
403
|
))
|