ordering-ui-react-native 0.21.33-test → 0.21.33
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/business/src/components/Chat/index.tsx +23 -14
- package/themes/business/src/components/OrdersOption/index.tsx +2 -7
- package/themes/original/src/components/BusinessInformation/index.tsx +1 -0
- package/themes/original/src/components/Checkout/index.tsx +12 -1
- package/themes/original/src/components/GoogleMap/index.tsx +5 -4
- package/themes/original/src/components/Messages/index.tsx +1 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptions/index.tsx +3 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +14 -2
- package/themes/original/src/types/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -386,21 +386,30 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
386
386
|
style={{ ...styles.firstMessageText, textAlign: 'center' }}
|
|
387
387
|
>
|
|
388
388
|
{
|
|
389
|
-
message.change?.attribute
|
|
390
|
-
?
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
: message.change.new
|
|
389
|
+
message.change?.attribute === 'driver_group_id'
|
|
390
|
+
? message.change.old
|
|
391
|
+
? t('ORDER_ATTRIBUTE_CHANGED_FROM_TO')
|
|
392
|
+
.replace('_attribute_', t(message.change?.attribute.toUpperCase()).toLowerCase())
|
|
393
|
+
.replace('_from_', message.change.old)
|
|
394
|
+
.replace('_to_', message.change.new)
|
|
395
|
+
: t('ORDER_ATTRIBUTE_CHANGED_TO')
|
|
396
|
+
.replace('_attribute_', t(message.change?.attribute.toUpperCase()).toLowerCase())
|
|
397
|
+
.replace('_to_', message.change.new)
|
|
398
|
+
: message.change?.attribute !== 'driver_id'
|
|
400
399
|
?
|
|
401
|
-
`${
|
|
402
|
-
|
|
403
|
-
|
|
400
|
+
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
|
|
401
|
+
? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
|
|
402
|
+
: `${message.change?.attribute !== 'logistic_status'
|
|
403
|
+
? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
|
|
404
|
+
: message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
|
|
405
|
+
? t(ORDER_STATUS[parseInt(message.change.new, 10)])
|
|
406
|
+
: getLogisticTag(message.change.new)}`
|
|
407
|
+
}`
|
|
408
|
+
: message.change.new
|
|
409
|
+
?
|
|
410
|
+
`${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
|
|
411
|
+
:
|
|
412
|
+
`${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
|
|
404
413
|
}
|
|
405
414
|
</OText>
|
|
406
415
|
<OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
|
|
@@ -12,7 +12,7 @@ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrienta
|
|
|
12
12
|
import { NotificationSetting } from '../../../../../src/components/NotificationSetting'
|
|
13
13
|
import { NewOrderNotification } from '../NewOrderNotification';
|
|
14
14
|
|
|
15
|
-
import { OText, OButton, OModal,
|
|
15
|
+
import { OText, OButton, OModal, OInput, OIcon } from '../shared';
|
|
16
16
|
import { NotFoundSource } from '../NotFoundSource';
|
|
17
17
|
import {
|
|
18
18
|
FiltersTab,
|
|
@@ -93,17 +93,14 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
93
93
|
const [{ parseDate }] = useUtils()
|
|
94
94
|
const [configState] = useConfig()
|
|
95
95
|
const [orientationState] = useDeviceOrientation();
|
|
96
|
-
const [, { showToast }] = useToast();
|
|
97
96
|
const [openSearchModal, setOpenSearchModal] = useState(false)
|
|
98
97
|
const [openSLASettingModal, setOpenSLASettingModal] = useState(false)
|
|
99
98
|
const [slaSettingTime, setSlaSettingTime] = useState(6000)
|
|
100
99
|
const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
|
|
101
100
|
const [search, setSearch] = useState(defaultSearchList)
|
|
102
101
|
const [selectedTabStatus, setSelectedTabStatus] = useState<any>([])
|
|
103
|
-
const [hour, setHour] = useState(0)
|
|
104
|
-
const [minute, setMinute] = useState(0)
|
|
105
102
|
const [openedSelect, setOpenedSelect] = useState('')
|
|
106
|
-
|
|
103
|
+
|
|
107
104
|
const HEIGHT_SCREEN = orientationState?.dimensions?.height
|
|
108
105
|
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
109
106
|
|
|
@@ -927,8 +924,6 @@ export const Timer = () => {
|
|
|
927
924
|
|
|
928
925
|
export const OrdersOption = (props: OrdersOptionParams) => {
|
|
929
926
|
const [, t] = useLanguage();
|
|
930
|
-
const [configState] = useConfig()
|
|
931
|
-
const theme = useTheme()
|
|
932
927
|
const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
|
|
933
928
|
const ordersProps = {
|
|
934
929
|
...props,
|
|
@@ -106,6 +106,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
106
106
|
location={businessLocation.location}
|
|
107
107
|
markerTitle={businessState?.business?.name}
|
|
108
108
|
businessZones={businessState?.business?.zones}
|
|
109
|
+
delta={30}
|
|
109
110
|
/>
|
|
110
111
|
</WrapBusinessMap>
|
|
111
112
|
)}
|
|
@@ -192,6 +192,7 @@ const CheckoutUI = (props: any) => {
|
|
|
192
192
|
}, cart?.subtotal)
|
|
193
193
|
|
|
194
194
|
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
195
|
+
const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled && validationFields?.fields?.card?.zipcode?.required && !paymethodSelected?.data?.card?.zipcode
|
|
195
196
|
|
|
196
197
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
197
198
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
@@ -200,7 +201,8 @@ const CheckoutUI = (props: any) => {
|
|
|
200
201
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
201
202
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
202
203
|
(Number(cart?.driver_tip) <= 0)) ||
|
|
203
|
-
(validateCommentsCartField)
|
|
204
|
+
(validateCommentsCartField) ||
|
|
205
|
+
(validateZipcodeCard)
|
|
204
206
|
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
205
207
|
|
|
206
208
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
@@ -896,6 +898,15 @@ const CheckoutUI = (props: any) => {
|
|
|
896
898
|
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
897
899
|
</OText>
|
|
898
900
|
)}
|
|
901
|
+
|
|
902
|
+
{validateZipcodeCard && (
|
|
903
|
+
<OText
|
|
904
|
+
color={theme.colors.error}
|
|
905
|
+
size={12}
|
|
906
|
+
>
|
|
907
|
+
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
908
|
+
</OText>
|
|
909
|
+
)}
|
|
899
910
|
</ChErrors>
|
|
900
911
|
</View>
|
|
901
912
|
)}
|
|
@@ -20,7 +20,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
20
20
|
handleToggleMap,
|
|
21
21
|
locations,
|
|
22
22
|
isIntGeoCoder,
|
|
23
|
-
businessZones
|
|
23
|
+
businessZones,
|
|
24
|
+
delta
|
|
24
25
|
} = props
|
|
25
26
|
|
|
26
27
|
const [, t] = useLanguage()
|
|
@@ -31,8 +32,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
31
32
|
const [region, setRegion] = useState({
|
|
32
33
|
latitude: location.lat,
|
|
33
34
|
longitude: location.lng,
|
|
34
|
-
latitudeDelta: 0.0010,
|
|
35
|
-
longitudeDelta: 0.0010 * ASPECT_RATIO
|
|
35
|
+
latitudeDelta: delta ?? 0.0010,
|
|
36
|
+
longitudeDelta: (delta ?? 0.0010) * ASPECT_RATIO
|
|
36
37
|
})
|
|
37
38
|
const [MARKERS, SETMARKERS] = useState(locations)
|
|
38
39
|
let mapRef = useRef<any>(null)
|
|
@@ -265,7 +266,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
265
266
|
)}
|
|
266
267
|
{(businessZone.type === 5 && businessZone?.data?.distance) && (
|
|
267
268
|
<Circle
|
|
268
|
-
center={{ latitude:
|
|
269
|
+
center={{ latitude: center.lat, longitude: center.lng}}
|
|
269
270
|
radius={businessZone?.data.distance * units[businessZone?.data?.unit]}
|
|
270
271
|
fillColor={fillStyles.fillColor}
|
|
271
272
|
strokeColor={fillStyles.strokeColor}
|
|
@@ -152,6 +152,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
152
152
|
}
|
|
153
153
|
const newMessage: any = [];
|
|
154
154
|
messages.messages.map((message: any) => {
|
|
155
|
+
if (message.change?.attribute === 'driver_group_id') return
|
|
155
156
|
if (business && message.type !== 0 && (messagesToShow?.messages?.length || message?.can_see?.includes('2'))) {
|
|
156
157
|
newMessage.push({
|
|
157
158
|
_id: message?.id,
|
|
@@ -117,9 +117,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
117
117
|
// { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
|
|
118
118
|
// ]
|
|
119
119
|
|
|
120
|
+
const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
|
|
121
|
+
|
|
120
122
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
121
123
|
if (cart?.balance > 0) {
|
|
122
|
-
if (paymethod?.gateway
|
|
124
|
+
if (paymethodsFieldRequired.includes(paymethod?.gateway) && requiredFields.length > 0) {
|
|
123
125
|
openUserModal && openUserModal(true)
|
|
124
126
|
setPaymethodClicked({
|
|
125
127
|
confirmed: false,
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
PaymentOptionStripe,
|
|
5
5
|
useSession,
|
|
6
6
|
useLanguage,
|
|
7
|
+
useValidationFields
|
|
7
8
|
} from 'ordering-components/native';
|
|
8
9
|
import { PlaceholderLine } from 'rn-placeholder';
|
|
9
10
|
import { useTheme } from 'styled-components/native';
|
|
@@ -40,10 +41,13 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
40
41
|
|
|
41
42
|
const [{ token }] = useSession();
|
|
42
43
|
const [, t] = useLanguage();
|
|
43
|
-
|
|
44
|
+
const [validationFields] = useValidationFields()
|
|
45
|
+
const validateZipcodeCard =
|
|
46
|
+
validationFields?.fields?.card?.zipcode?.enabled && validationFields?.fields?.card?.zipcode?.required
|
|
44
47
|
const paymethodsWithoutSaveCards = ['credomatic']
|
|
45
48
|
|
|
46
49
|
const handleCardSelected = (card: any) => {
|
|
50
|
+
if (!card?.zipcode && validateZipcodeCard) return
|
|
47
51
|
handleCardClick(card);
|
|
48
52
|
onSelectCard(card);
|
|
49
53
|
}
|
|
@@ -92,7 +96,8 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
92
96
|
style={styles.cardsList}
|
|
93
97
|
>
|
|
94
98
|
{cardsList.cards.map((card: any) => (
|
|
95
|
-
<OSItem key={card.id} isUnique={cardsList.cards.length}>
|
|
99
|
+
<OSItem key={card.id} isUnique={cardsList.cards.length} isInvalid={!card?.zipcode && validateZipcodeCard}>
|
|
100
|
+
{console.log(card?.zipcode && validateZipcodeCard)}
|
|
96
101
|
<OSItemContent onPress={() => handleCardSelected(card)}>
|
|
97
102
|
<View style={styles.viewStyle}>
|
|
98
103
|
{card.id === cardSelected?.id ? (
|
|
@@ -117,6 +122,13 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
117
122
|
XXXX-XXXX-XXXX-{card.last4}
|
|
118
123
|
</OText>
|
|
119
124
|
</View>
|
|
125
|
+
{!card?.zipcode && validateZipcodeCard && (
|
|
126
|
+
<View style={styles.viewStyle}>
|
|
127
|
+
<OText size={10} color={theme?.colors?.danger5}>
|
|
128
|
+
({t('MISSING_ZIPCODE', 'Missing zipcode')})
|
|
129
|
+
</OText>
|
|
130
|
+
</View>
|
|
131
|
+
)}
|
|
120
132
|
</OSItemContent>
|
|
121
133
|
<OSItemActions>
|
|
122
134
|
<OAlert
|