ordering-ui-react-native 0.23.57 → 0.23.58
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
CHANGED
|
@@ -175,9 +175,12 @@ const CheckoutUI = (props: any) => {
|
|
|
175
175
|
const [showTitle, setShowTitle] = useState(false)
|
|
176
176
|
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
177
177
|
const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
|
|
178
|
+
const [userHasCards, setUserHasCards] = useState(false)
|
|
178
179
|
const containerRef = useRef<any>()
|
|
179
180
|
const cardsMethods = ['credomatic']
|
|
180
181
|
const stripePaymethods: any = ['stripe', 'stripe_connect', 'stripe_redirect']
|
|
182
|
+
const cardsPaymethods: any = ['stripe', 'stripe_connect']
|
|
183
|
+
|
|
181
184
|
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
182
185
|
|
|
183
186
|
const checkoutFields = useMemo(() => checkoutFieldsState?.fields?.filter((field: any) => field.order_type_id === options?.type), [checkoutFieldsState, options])
|
|
@@ -226,8 +229,8 @@ const CheckoutUI = (props: any) => {
|
|
|
226
229
|
validateCommentsCartField ||
|
|
227
230
|
validateDriverTipField ||
|
|
228
231
|
validateCouponField ||
|
|
229
|
-
validateZipcodeCard
|
|
230
|
-
|
|
232
|
+
validateZipcodeCard ||
|
|
233
|
+
(!userHasCards && cardsPaymethods.includes(paymethodSelected?.gateway))
|
|
231
234
|
|
|
232
235
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
233
236
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -868,6 +871,7 @@ const CheckoutUI = (props: any) => {
|
|
|
868
871
|
openUserModal={setIsOpen}
|
|
869
872
|
paymethodClicked={paymethodClicked}
|
|
870
873
|
setPaymethodClicked={setPaymethodClicked}
|
|
874
|
+
setUserHasCards={setUserHasCards}
|
|
871
875
|
/>
|
|
872
876
|
</ChPaymethods>
|
|
873
877
|
</ChSection>
|
|
@@ -377,7 +377,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
377
377
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
378
378
|
/>
|
|
379
379
|
)}
|
|
380
|
-
{(preorderMinimumDays === 0 && preorderLeadTime === 0) || !cateringPreorder && (
|
|
380
|
+
{((preorderMinimumDays === 0 && preorderLeadTime === 0) || !cateringPreorder) && (
|
|
381
381
|
<WrapSelectOption
|
|
382
382
|
onPress={() => _handleAsap()}
|
|
383
383
|
disabled={orderState.loading} style={{ alignItems: 'flex-start' }}>
|
|
@@ -510,4 +510,4 @@ export const MomentOption = (props: any) => {
|
|
|
510
510
|
UIComponent: MomentOptionUI,
|
|
511
511
|
};
|
|
512
512
|
return <MomentOptionController {...momentOptionProps} />;
|
|
513
|
-
};
|
|
513
|
+
};
|
|
@@ -76,7 +76,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
76
76
|
openUserModal,
|
|
77
77
|
paymethodClicked,
|
|
78
78
|
setPaymethodClicked,
|
|
79
|
-
androidAppId
|
|
79
|
+
androidAppId,
|
|
80
|
+
setUserHasCards
|
|
80
81
|
} = props
|
|
81
82
|
|
|
82
83
|
const theme = useTheme();
|
|
@@ -348,6 +349,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
348
349
|
businessId={props.businessId}
|
|
349
350
|
onPaymentChange={onPaymentChange}
|
|
350
351
|
paySelected={props.paySelected}
|
|
352
|
+
setUserHasCards={setUserHasCards}
|
|
351
353
|
/>
|
|
352
354
|
</View>
|
|
353
355
|
)}
|
|
@@ -440,6 +442,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
440
442
|
publicKey={isOpenMethod?.paymethod?.credentials.publishable}
|
|
441
443
|
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
442
444
|
paySelected={props.paySelected}
|
|
445
|
+
setUserHasCards={setUserHasCards}
|
|
443
446
|
/>
|
|
444
447
|
</View>
|
|
445
448
|
)}
|
|
@@ -32,7 +32,8 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
32
32
|
gateway,
|
|
33
33
|
paySelected,
|
|
34
34
|
newCardAdded,
|
|
35
|
-
addNewCardAsDefault
|
|
35
|
+
addNewCardAsDefault,
|
|
36
|
+
setUserHasCards
|
|
36
37
|
} = props;
|
|
37
38
|
|
|
38
39
|
const theme = useTheme();
|
|
@@ -62,6 +63,11 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
62
63
|
}
|
|
63
64
|
}, [JSON.stringify(newCardAdded)])
|
|
64
65
|
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const hasCardSelected = cardsList?.cards?.some?.((card : any) => card?.id === paySelected?.data?.id)
|
|
68
|
+
setUserHasCards && setUserHasCards(cardsList?.cards?.length > 0 && hasCardSelected)
|
|
69
|
+
}, [cardsList?.cards?.length])
|
|
70
|
+
|
|
65
71
|
return (
|
|
66
72
|
<>
|
|
67
73
|
{token && !cardsList.loading && cardsList.cards && cardsList.cards.length === 0 && (
|