ordering-ui-react-native 0.18.36 → 0.18.38
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/StripeMethodForm/index.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +8 -1
- package/themes/original/src/components/Checkout/index.tsx +15 -2
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +2 -1
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
|
|
|
20
20
|
const [initialized, setInitialized] = useState(false);
|
|
21
21
|
const [loadingGooglePayment, setLoadingGooglePayment] = useState(false)
|
|
22
22
|
const [, t] = useLanguage()
|
|
23
|
-
const [configs] = useConfig()
|
|
23
|
+
const [{configs}] = useConfig()
|
|
24
24
|
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
if (paymethod !== 'google_pay' || !initGooglePay) return
|
|
@@ -170,7 +170,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
170
170
|
if (date.getDate() !== dateSeleted.getDate() || i >= date.getHours()) {
|
|
171
171
|
let hour = ''
|
|
172
172
|
let meridian = ''
|
|
173
|
-
if (
|
|
173
|
+
if (is12hours) {
|
|
174
174
|
if (i === 0) {
|
|
175
175
|
hour = '12'
|
|
176
176
|
meridian = ' ' + t('AM', 'AM')
|
|
@@ -84,7 +84,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
84
84
|
const appState = useRef(AppState.currentState)
|
|
85
85
|
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
86
86
|
const [refreshing] = useState(false);
|
|
87
|
-
const
|
|
87
|
+
const allCitiesDisabled = citiesState?.cities?.every((city: any) => !city.enabled)
|
|
88
|
+
const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2 || allCitiesDisabled) ?? true
|
|
88
89
|
const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
|
|
89
90
|
const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
|
|
90
91
|
const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
|
|
@@ -293,6 +294,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
293
294
|
setIsOpenCities(false)
|
|
294
295
|
}, [orderState?.options?.city_id])
|
|
295
296
|
|
|
297
|
+
useEffect(() => {
|
|
298
|
+
if (!citiesState?.cities?.length || !orderState?.options?.city_id) return
|
|
299
|
+
const selectedCity = citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)
|
|
300
|
+
if (!selectedCity || !selectedCity?.enabled) changeCityFilter(null)
|
|
301
|
+
}, [citiesState, orderState?.options?.city_id])
|
|
302
|
+
|
|
296
303
|
if (logosLayout) {
|
|
297
304
|
return (
|
|
298
305
|
<BusinessLogosContainer
|
|
@@ -152,7 +152,7 @@ const CheckoutUI = (props: any) => {
|
|
|
152
152
|
const [isOpen, setIsOpen] = useState(false)
|
|
153
153
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
154
154
|
const [openModal, setOpenModal] = useState({ login: false, signup: false })
|
|
155
|
-
|
|
155
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
156
156
|
|
|
157
157
|
const placeSpotTypes = [3, 4, 5]
|
|
158
158
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
@@ -177,12 +177,16 @@ const CheckoutUI = (props: any) => {
|
|
|
177
177
|
return acc = acc + item?.summary?.tax
|
|
178
178
|
return acc = acc
|
|
179
179
|
}, cart?.subtotal)
|
|
180
|
+
|
|
181
|
+
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
182
|
+
|
|
180
183
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
181
184
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
182
185
|
(options.type === 1 &&
|
|
183
186
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
184
187
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
185
|
-
(Number(cart?.driver_tip) <= 0))
|
|
188
|
+
(Number(cart?.driver_tip) <= 0)) ||
|
|
189
|
+
(validateCommentsCartField)
|
|
186
190
|
|
|
187
191
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
188
192
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -797,6 +801,15 @@ const CheckoutUI = (props: any) => {
|
|
|
797
801
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
798
802
|
</OText>
|
|
799
803
|
)}
|
|
804
|
+
|
|
805
|
+
{validateCommentsCartField && (
|
|
806
|
+
<OText
|
|
807
|
+
color={theme.colors.error}
|
|
808
|
+
size={12}
|
|
809
|
+
>
|
|
810
|
+
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
811
|
+
</OText>
|
|
812
|
+
)}
|
|
800
813
|
</ChErrors>
|
|
801
814
|
</View>
|
|
802
815
|
)}
|
|
@@ -47,7 +47,7 @@ export const CitiesControl = (props: any) => {
|
|
|
47
47
|
return (
|
|
48
48
|
<Container height={height - top - bottom - 60 - (isKeyboardShow ? 250 : 0)}>
|
|
49
49
|
<View>
|
|
50
|
-
{cities?.map((city: any) => (
|
|
50
|
+
{cities?.map((city: any) => city?.enabled && (
|
|
51
51
|
<CityElement
|
|
52
52
|
key={city?.id}
|
|
53
53
|
activeOpacity={1}
|
|
@@ -60,6 +60,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
60
60
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
61
61
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
62
62
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
63
|
+
const hideCartComments = !validationFields?.fields?.checkout?.comments?.enabled
|
|
63
64
|
|
|
64
65
|
const cart = orderState?.carts?.[`businessId:${props.cart.business_id}`]
|
|
65
66
|
|
|
@@ -323,7 +324,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
323
324
|
)}
|
|
324
325
|
</View>
|
|
325
326
|
)}
|
|
326
|
-
{cart?.business_id && cart?.status !== 2 && (
|
|
327
|
+
{cart?.business_id && cart?.status !== 2 && !hideCartComments && (
|
|
327
328
|
<OSTable>
|
|
328
329
|
<View style={{ width: '100%', marginTop: 20 }}>
|
|
329
330
|
<OText size={12}>{t('COMMENTS', 'Comments')}</OText>
|