Merge pull request 'fixed-issue(32): cupon validation and other minor issues like gateway fees and UI' (#51) from cupon-validation-fix into main
Reviewed-on: https://10.10.0.4/AcuPedia/acupedia-store-ui/pulls/51 Reviewed-by: Amit Salunke <amit@noreply.localhost>
This commit is contained in:
commit
c9e19047e9
|
|
@ -0,0 +1,2 @@
|
|||
Branch: main
|
||||
Commit: 75acd1de923fe310458333b66b71450f444eee2b
|
||||
|
|
@ -656,7 +656,7 @@ export default function App() {
|
|||
}, { headers });
|
||||
|
||||
const calcData = res.data;
|
||||
if (appliedCoupon && (!calcData.coupon_applied || calcData.coupon_applied === 'None')) {
|
||||
if (appliedCoupon && (!calcData.coupon_applied || calcData.coupon_applied === 'None' || calcData.coupon_discount_amount <= 0)) {
|
||||
calcData.coupon_error = calcData.coupon_error || 'Invalid or expired coupon code.';
|
||||
}
|
||||
setPricingCalc(calcData);
|
||||
|
|
@ -789,6 +789,7 @@ export default function App() {
|
|||
pricingCalc &&
|
||||
pricingCalc.coupon_applied &&
|
||||
pricingCalc.coupon_applied !== 'None' &&
|
||||
pricingCalc.coupon_discount_amount > 0 &&
|
||||
!pricingCalc.coupon_error
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ export const CartDrawer: React.FC<CartDrawerProps> = ({
|
|||
</button>
|
||||
</div>
|
||||
{appliedCoupon &&
|
||||
(pricingCalc?.coupon_error || !pricingCalc?.coupon_applied || pricingCalc?.coupon_applied === 'None' ? (
|
||||
(pricingCalc?.coupon_error || !pricingCalc?.coupon_applied || pricingCalc?.coupon_applied === 'None' || (pricingCalc?.coupon_discount_amount !== undefined && pricingCalc?.coupon_discount_amount <= 0) ? (
|
||||
<div className="flex justify-between items-center bg-rose-50 border border-rose-200 text-rose-700 text-xs px-3 py-2 rounded-xl font-bold">
|
||||
<span className="flex items-center gap-1">
|
||||
⚠️ {pricingCalc?.coupon_error || 'Invalid or expired coupon code.'}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,19 @@ export const PaymentSuccessModal: React.FC<PaymentSuccessModalProps> = ({
|
|||
returnRoute,
|
||||
appScheme,
|
||||
}) => {
|
||||
const [desktopNotice] = useState(false);
|
||||
const [desktopNotice, setDesktopNotice] = useState(false);
|
||||
|
||||
// Handler to reliably launch the Acupedia Mobile App across platforms
|
||||
const handleOpenApp = (e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
openMobileApp({ route: returnRoute, schemes: appScheme ? [appScheme] : undefined });
|
||||
|
||||
const userAgent = navigator.userAgent || '';
|
||||
const isMobile = /Android|iPhone|iPad|iPod/i.test(userAgent);
|
||||
if (!isMobile) {
|
||||
setDesktopNotice(true);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4 bg-slate-950/75 backdrop-blur-md transition-all duration-300">
|
||||
<div className="relative w-full max-w-xl bg-slate-900 border border-slate-800 rounded-2xl p-5 md:p-6 space-y-4 shadow-2xl text-slate-100 overflow-hidden animate-in fade-in zoom-in-95 duration-200">
|
||||
|
|
@ -182,18 +194,14 @@ export const PaymentSuccessModal: React.FC<PaymentSuccessModalProps> = ({
|
|||
)}
|
||||
|
||||
{/* Open in App Button */}
|
||||
{/* Open in App Button */}
|
||||
<a
|
||||
href={getAppDeepLinkUrls({ route: returnRoute, schemes: appScheme ? [appScheme] : undefined })[0]}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
openMobileApp({ route: returnRoute, schemes: appScheme ? [appScheme] : undefined });
|
||||
}}
|
||||
className="w-full h-9 bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs rounded-lg transition-all duration-300 flex items-center justify-center gap-2 shadow-md shadow-emerald-600/10 no-underline decoration-0 cursor-pointer"
|
||||
>
|
||||
<Smartphone className="h-3.5 w-3.5 text-emerald-200" />
|
||||
Open in App / Library
|
||||
</a>
|
||||
<a
|
||||
href={getAppDeepLinkUrls({ route: returnRoute, schemes: appScheme ? [appScheme] : undefined })[0]}
|
||||
onClick={handleOpenApp}
|
||||
className="w-full h-9 bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs rounded-lg transition-all duration-300 flex items-center justify-center gap-2 shadow-md shadow-emerald-600/10 no-underline decoration-0 cursor-pointer"
|
||||
>
|
||||
<Smartphone className="h-3.5 w-3.5 text-emerald-200" />
|
||||
Open in App / Library
|
||||
</a>
|
||||
|
||||
{desktopNotice && (
|
||||
<div className="p-2.5 bg-slate-950 border border-emerald-900/40 rounded-lg text-center animate-in fade-in duration-200">
|
||||
|
|
|
|||
Loading…
Reference in New Issue