ok
This commit is contained in:
@@ -78,6 +78,8 @@ const LinktreePage = ({ data, setModal }) => {
|
||||
// Handle manual coupon code check
|
||||
const handleLogCouponForUser = async (code = couponCode) => {
|
||||
const result = await logCouponForUser(code); // Call the helper
|
||||
|
||||
return result.success;
|
||||
};
|
||||
|
||||
// Listen for query parameter changes (using the `location` object)
|
||||
@@ -106,20 +108,11 @@ const LinktreePage = ({ data, setModal }) => {
|
||||
<div className={styles.subHeadingTransparent}>
|
||||
Daftarkan kedaimu sekarang dan mulai gunakan semua fitur unggulan kami.
|
||||
</div>
|
||||
<form className={styles.linktreeForm}>
|
||||
<label htmlFor="username" className={styles.usernameLabel}>
|
||||
--------------------------------------------
|
||||
</label>
|
||||
<input
|
||||
id="username"
|
||||
placeholder="nomor whatsapp atau email"
|
||||
maxLength="30"
|
||||
className={styles.usernameInput}
|
||||
/>
|
||||
<button type="submit" className={styles.claimButton}>
|
||||
<span>➜</span>
|
||||
<div className={styles.linktreeForm}>
|
||||
<button onClick={()=>window.open("https://api.whatsapp.com/send?phone=6281318894994&text=Saya%20ingin%20coba%20gratis%203%20bulan")} className={styles.claimButton}>
|
||||
<span>Dapatkan voucher gratis 3 bulan</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div className={styles.footer}>
|
||||
<div className={styles.footerLinks}>
|
||||
<a
|
||||
@@ -131,7 +124,10 @@ const LinktreePage = ({ data, setModal }) => {
|
||||
Pelajari lebih lanjut
|
||||
</a>
|
||||
<a
|
||||
onClick={() => setIsUsingCoupon(true)}
|
||||
onClick={(e) => {
|
||||
e.preventDefault(); // Prevent the default anchor behavior
|
||||
setIsUsingCoupon(true);
|
||||
}}
|
||||
className={styles.footerLink}
|
||||
>
|
||||
Gunakan Voucher
|
||||
@@ -141,14 +137,14 @@ const LinktreePage = ({ data, setModal }) => {
|
||||
</div>
|
||||
) : (
|
||||
<div className={styles.dashboardContainer}>
|
||||
<div className={styles.mainHeading}>{isOnlyClaimCoupon ? 'Aktifkan Voucher' : 'Daftar Dengan Voucher'}</div>
|
||||
<div className={styles.voucherHeading}>{isOnlyClaimCoupon ? 'Aktifkan Voucher' : 'Daftar Dengan Voucher'}</div>
|
||||
<div className={styles.subHeading}>
|
||||
Voucher dapat digunakan untuk pembuatan akun bisnis maupun untuk memperpanjang masa berlangganan.
|
||||
</div>
|
||||
{couponStatus === 0 ? (
|
||||
<form className={styles.linktreeForm} onSubmit={(e) => e.preventDefault()}>
|
||||
<label htmlFor="coupon" className={styles.usernameLabel}>
|
||||
--------------------------------------------
|
||||
----------------------------------------
|
||||
</label>
|
||||
<input
|
||||
id="coupon"
|
||||
@@ -179,21 +175,31 @@ const LinktreePage = ({ data, setModal }) => {
|
||||
<button
|
||||
className={styles.claimButton}
|
||||
style={{ width: '266px' }}
|
||||
onClick={() => {
|
||||
onClick={async () => {
|
||||
if (!isOnlyClaimCoupon) {
|
||||
|
||||
const secretKey = 'xixixi666'; // Your AES-256 key (32 characters)
|
||||
|
||||
|
||||
// Encrypt couponCode inline
|
||||
const encryptedCouponCode = CryptoJS.AES.encrypt(couponCode, secretKey).toString();
|
||||
console.log(encryptedCouponCode)
|
||||
// If it's only claiming a coupon, trigger claim logic
|
||||
console.log(encryptedCouponCode);
|
||||
|
||||
// If it's not for claiming a coupon, trigger the create user modal logic
|
||||
setModal('create_user', { codeStatus: 200, c: encryptedCouponCode });
|
||||
} else {
|
||||
// Otherwise, handle the coupon for user creation
|
||||
handleLogCouponForUser();
|
||||
try {
|
||||
// Otherwise, handle the coupon for user creation
|
||||
setModal('loading');
|
||||
|
||||
const loggingcoupon = await handleLogCouponForUser(); // Await the coupon logging process
|
||||
setModal('message', {
|
||||
returnMessage: loggingcoupon ? 'Kupon berhasil ditambahkan' : 'Kupon gagal ditambahkan'
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error during coupon handling:', error);
|
||||
setModal('message', { returnMessage: 'Kupon gagal ditambahkan' });
|
||||
}
|
||||
}
|
||||
}}
|
||||
}}
|
||||
>
|
||||
<span>{isOnlyClaimCoupon ? 'Aktifkan untuk akun ini' : 'Buat akun bisnis dengan voucher ini'}</span>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user