Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sweepstake
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arjun Jhukal
sweepstake
Commits
269feb45
Commit
269feb45
authored
Sep 23, 2025
by
Arjun Jhukal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated teh checkout props to fix build
parent
15bfac34
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
2 deletions
+127
-2
page.tsx
...app/(dashboard)/(user)/buy-coins/[slug]/checkout/page.tsx
+1
-2
AgeChecker.tsx
src/app/AgeChecker.tsx
+99
-0
ProviderWrapper.tsx
src/app/ProviderWrapper.tsx
+6
-0
layout.tsx
src/app/layout.tsx
+2
-0
ageChecker.ts
src/utils/ageChecker.ts
+19
-0
No files found.
src/app/(dashboard)/(user)/buy-coins/[slug]/checkout/page.tsx
View file @
269feb45
...
@@ -9,8 +9,7 @@ interface Props {
...
@@ -9,8 +9,7 @@ interface Props {
searchParams
:
{
amount
?:
string
;
bonus
?:
string
};
searchParams
:
{
amount
?:
string
;
bonus
?:
string
};
params
:
{
slug
:
string
};
params
:
{
slug
:
string
};
}
}
export
default
async
function
CheckoutPage
(
props
:
Promise
<
Props
>
)
{
export
default
async
function
CheckoutPage
({
searchParams
,
params
}:
Props
)
{
const
{
searchParams
,
params
}
=
await
props
;
const
amount
=
searchParams
.
amount
?
Number
(
searchParams
.
amount
)
:
0
;
const
amount
=
searchParams
.
amount
?
Number
(
searchParams
.
amount
)
:
0
;
const
bonus
=
searchParams
.
bonus
?
Number
(
searchParams
.
bonus
)
:
0
;
const
bonus
=
searchParams
.
bonus
?
Number
(
searchParams
.
bonus
)
:
0
;
const
slug
=
params
.
slug
;
const
slug
=
params
.
slug
;
...
...
src/app/AgeChecker.tsx
0 → 100644
View file @
269feb45
"use client"
;
import
{
getCookie
,
setCookie
}
from
'@/utils/ageChecker'
;
import
{
useEffect
}
from
'react'
;
interface
AgeCheckerProps
{
apiKey
:
string
;
onVerified
?:
()
=>
void
;
onSkipped
?:
()
=>
void
;
}
// Types for AgeChecker integration
interface
AgeCheckerConfig
{
mode
?:
string
;
key
:
string
;
path
?:
string
;
onready
?:
()
=>
void
;
onclosed
?:
()
=>
void
;
[
key
:
string
]:
unknown
;
}
interface
AgeCheckerAPI
{
show
:
()
=>
void
;
[
key
:
string
]:
unknown
;
}
// Extend Window interface to include AgeChecker globals
declare
global
{
interface
Window
{
AgeCheckerConfig
?:
AgeCheckerConfig
;
AgeCheckerAPI
?:
AgeCheckerAPI
;
}
}
export
const
AgeChecker
:
React
.
FC
<
AgeCheckerProps
>
=
({
apiKey
,
onVerified
,
onSkipped
})
=>
{
useEffect
(()
=>
{
// Check if user is already verified
if
(
getCookie
(
"ac_custom_verified"
))
{
onSkipped
?.();
return
;
}
// AgeChecker configuration
const
config
:
AgeCheckerConfig
=
{
mode
:
"manual"
,
key
:
apiKey
,
onready
:
()
=>
{
if
(
window
.
AgeCheckerAPI
)
{
window
.
AgeCheckerAPI
.
show
();
}
},
onclosed
:
()
=>
{
setCookie
(
"ac_custom_verified"
,
"true"
,
30
);
onVerified
?.();
}
};
// Set global config
window
.
AgeCheckerConfig
=
config
;
// Check if path condition should prevent loading (from original script)
// Only check if path is defined in config
if
(
config
.
path
&&
(
window
.
location
.
pathname
+
window
.
location
.
search
).
indexOf
(
config
.
path
))
{
return
;
}
// Load AgeChecker script
const
head
=
document
.
getElementsByTagName
(
"head"
)[
0
];
const
script
=
document
.
createElement
(
"script"
);
script
.
src
=
"https://cdn.agechecker.net/static/popup/v1/popup.js"
;
script
.
crossOrigin
=
"anonymous"
;
script
.
onerror
=
()
=>
{
window
.
location
.
href
=
"https://agechecker.net/loaderror"
;
};
head
.
insertBefore
(
script
,
head
.
firstChild
);
// Cleanup function
return
()
=>
{
// Remove script if component unmounts
const
existingScript
=
document
.
querySelector
(
'script[src="https://cdn.agechecker.net/static/popup/v1/popup.js"]'
);
if
(
existingScript
)
{
existingScript
.
remove
();
}
};
},
[
apiKey
,
onVerified
,
onSkipped
]);
return
(
<>
{
/* NoScript fallback */
}
<
noscript
>
<
meta
httpEquiv=
"refresh"
content=
"0;url=https://agechecker.net/noscript"
/>
</
noscript
>
</>
);
};
src/app/ProviderWrapper.tsx
View file @
269feb45
...
@@ -3,6 +3,7 @@ import { ThemeContextProvider } from '@/context/ThemeContext'
...
@@ -3,6 +3,7 @@ import { ThemeContextProvider } from '@/context/ThemeContext'
import
{
ClientProvider
}
from
'@/hooks/ReduxProvider'
import
{
ClientProvider
}
from
'@/hooks/ReduxProvider'
import
ThemeCustomization
from
'@/theme'
import
ThemeCustomization
from
'@/theme'
import
React
from
'react'
import
React
from
'react'
import
{
AgeChecker
}
from
'./AgeChecker'
export
default
function
ProviderWrapper
({
children
}:
{
children
:
React
.
ReactNode
})
{
export
default
function
ProviderWrapper
({
children
}:
{
children
:
React
.
ReactNode
})
{
return
(
return
(
...
@@ -11,6 +12,11 @@ export default function ProviderWrapper({ children }: { children: React.ReactNod
...
@@ -11,6 +12,11 @@ export default function ProviderWrapper({ children }: { children: React.ReactNod
<
ThemeCustomization
>
<
ThemeCustomization
>
{
children
}
{
children
}
<
Toast
/>
<
Toast
/>
{
/* <AgeChecker
apiKey="lwU8lOYysWXrIZaijSG3Hfcxmzc4DlS9"
onVerified={() => { }}
onSkipped={() => { }}
/> */
}
</
ThemeCustomization
>
</
ThemeCustomization
>
</
ClientProvider
>
</
ClientProvider
>
</
ThemeContextProvider
>
</
ThemeContextProvider
>
...
...
src/app/layout.tsx
View file @
269feb45
...
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
...
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
import
{
Inter
}
from
"next/font/google"
;
import
{
Inter
}
from
"next/font/google"
;
import
"./globals.css"
;
import
"./globals.css"
;
import
ProviderWrapper
from
"./ProviderWrapper"
;
import
ProviderWrapper
from
"./ProviderWrapper"
;
import
{
AgeChecker
}
from
"./AgeChecker"
;
export
const
metadata
:
Metadata
=
{
export
const
metadata
:
Metadata
=
{
title
:
"Sweepstake"
,
title
:
"Sweepstake"
,
...
@@ -25,6 +26,7 @@ export default function RootLayout({
...
@@ -25,6 +26,7 @@ export default function RootLayout({
{
/* className="dark" */
}
{
/* className="dark" */
}
<
body
className=
{
`${inter.className} scroll-smooth dark`
}
>
<
body
className=
{
`${inter.className} scroll-smooth dark`
}
>
<
ProviderWrapper
>
<
ProviderWrapper
>
{
children
}
{
children
}
</
ProviderWrapper
>
</
ProviderWrapper
>
</
body
>
</
body
>
...
...
src/utils/ageChecker.ts
0 → 100644
View file @
269feb45
// Cookie utilities for age verification
export
const
getCookie
=
(
name
:
string
):
string
|
null
=>
{
const
value
=
`;
${
document
.
cookie
}
`
;
const
parts
=
value
.
split
(
`;
${
name
}
=`
);
if
(
parts
.
length
===
2
)
{
return
parts
.
pop
()?.
split
(
';'
).
shift
()
||
null
;
}
return
null
;
};
export
const
setCookie
=
(
name
:
string
,
value
:
string
|
boolean
,
days
=
30
):
void
=>
{
const
expires
=
new
Date
();
expires
.
setTime
(
expires
.
getTime
()
+
(
days
*
24
*
60
*
60
*
1000
));
document
.
cookie
=
`
${
name
}
=
${
value
}
;expires=
${
expires
.
toUTCString
()}
;path=/`
;
};
export
const
deleteCookie
=
(
name
:
string
):
void
=>
{
document
.
cookie
=
`
${
name
}
=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;`
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment