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
0396e588
Commit
0396e588
authored
Mar 03, 2026
by
Arjun Jhukal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated the new age gate
parent
e2a44554
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
5 deletions
+84
-5
layout.tsx
src/app/(dashboard)/(user)/(outsideAuth)/layout.tsx
+3
-0
layout.tsx
src/app/(dashboard)/(user)/(privateUser)/layout.tsx
+1
-0
AgeGate.tsx
src/components/organism/dialog/AgeGate.tsx
+61
-0
index.tsx
src/components/pages/auth/register/index.tsx
+2
-2
authApi.ts
src/services/authApi.ts
+16
-3
auth.ts
src/types/auth.ts
+1
-0
No files found.
src/app/(dashboard)/(user)/(outsideAuth)/layout.tsx
View file @
0396e588
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
Chatbot
from
'@/components/atom/ChatbotIcon'
;
import
Chatbot
from
'@/components/atom/ChatbotIcon'
;
import
DashboardLayout
from
'@/components/layouts/DashboardLayout'
;
import
DashboardLayout
from
'@/components/layouts/DashboardLayout'
;
import
AgeVerificationModal
from
'@/components/organism/dialog'
;
import
AgeVerificationModal
from
'@/components/organism/dialog'
;
import
AgeGate
from
'@/components/organism/dialog/AgeGate'
;
import
{
useSearchParams
}
from
'next/navigation'
;
import
{
useSearchParams
}
from
'next/navigation'
;
import
React
,
{
Suspense
,
useEffect
}
from
'react'
;
import
React
,
{
Suspense
,
useEffect
}
from
'react'
;
...
@@ -22,6 +23,8 @@ function LayoutContent({ children }: { children: React.ReactNode }) {
...
@@ -22,6 +23,8 @@ function LayoutContent({ children }: { children: React.ReactNode }) {
{
children
}
{
children
}
<
AgeVerificationModal
/>
<
AgeVerificationModal
/>
<
Chatbot
/>
<
Chatbot
/>
<
AgeGate
/>
</
DashboardLayout
>
</
DashboardLayout
>
)
)
}
}
...
...
src/app/(dashboard)/(user)/(privateUser)/layout.tsx
View file @
0396e588
...
@@ -5,6 +5,7 @@ import React from 'react'
...
@@ -5,6 +5,7 @@ import React from 'react'
export
default
function
PrivateUserLayout
({
children
}:
{
children
:
React
.
ReactNode
})
{
export
default
function
PrivateUserLayout
({
children
}:
{
children
:
React
.
ReactNode
})
{
return
(
return
(
<
ServerPrivate
>
<
ServerPrivate
>
<
DashboardLayout
>
<
DashboardLayout
>
{
children
}
{
children
}
</
DashboardLayout
>
</
DashboardLayout
>
...
...
src/components/organism/dialog/AgeGate.tsx
0 → 100644
View file @
0396e588
"use client"
;
import
{
useGetAgeGateUuidQuery
,
useVerifyAgeGateMutation
}
from
"@/services/authApi"
;
import
{
useCallback
,
useEffect
}
from
"react"
;
export
default
function
AgeGate
()
{
const
{
data
,
isSuccess
}
=
useGetAgeGateUuidQuery
();
const
[
verifyAgeGate
]
=
useVerifyAgeGateMutation
();
const
handleSuccess
=
useCallback
(
async
(
uuid
:
string
)
=>
{
try
{
await
verifyAgeGate
({
age_verify_uuid
:
uuid
}).
unwrap
();
window
.
location
.
reload
();
}
catch
(
err
)
{
console
.
error
(
"[AgeGate] Backend verification failed:"
,
err
);
}
},
[
verifyAgeGate
]);
console
.
log
(
"AgeGate data:"
,
data
?.
data
?.
age_verify_uuid
,
"isSuccess:"
,
isSuccess
);
useEffect
(()
=>
{
if
(
!
isSuccess
||
!
data
?.
data
?.
age_verify_uuid
)
return
;
if
(
data
.
data
.
is_age_verified
)
return
;
const
uuid
=
data
.
data
.
age_verify_uuid
;
// 1. Set config BEFORE loading the script
(
window
as
any
).
AgeCheckerConfig
=
{
key
:
process
.
env
.
NEXT_PUBLIC_AGE_CHECKER_KEY
,
mode
:
"manual"
,
autoload
:
true
,
onready
:
()
=>
{
(
window
as
any
).
AgeCheckerAPI
.
show
(
uuid
);
},
onstatuschanged
:
(
verification
:
{
uuid
:
string
;
status
:
string
})
=>
{
if
(
verification
.
status
===
"accepted"
)
{
handleSuccess
(
verification
.
uuid
);
}
},
};
// 3. Now load the script
const
existing
=
document
.
querySelector
(
'script[src*="agechecker.net"]'
);
if
(
existing
)
{
// Script already loaded, just show
(
window
as
any
).
AgeCheckerAPI
?.
show
(
uuid
);
return
;
}
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"
;
};
document
.
head
.
insertBefore
(
script
,
document
.
head
.
firstChild
);
},
[
isSuccess
,
data
,
handleSuccess
]);
return
null
;
}
\ No newline at end of file
src/components/pages/auth/register/index.tsx
View file @
0396e588
...
@@ -165,6 +165,7 @@ export default function RegisterPage() {
...
@@ -165,6 +165,7 @@ export default function RegisterPage() {
const cleanedPhone = values.phone.replace(/^0+/, '');
const cleanedPhone = values.phone.replace(/^0+/, '');
const fullPhoneNumber = `
$
{
values
.
country_code
}
$
{
cleanedPhone
}
`;
const fullPhoneNumber = `
$
{
values
.
country_code
}
$
{
cleanedPhone
}
`;
try {
try {
const response = await registerUser({
const response = await registerUser({
email: values.emailAddress,
email: values.emailAddress,
...
@@ -184,10 +185,9 @@ export default function RegisterPage() {
...
@@ -184,10 +185,9 @@ export default function RegisterPage() {
visitor_id: userFromPropeelVisitorId || undefined,
visitor_id: userFromPropeelVisitorId || undefined,
country_code: '',
country_code: '',
}).unwrap();
}).unwrap();
dispatch(
dispatch(
showToast({
showToast({
message: response?.
data?.
message || "User Registerd Successfully",
message: response?.message || "User Registerd Successfully",
variant: ToastVariant.SUCCESS,
variant: ToastVariant.SUCCESS,
autoTime: true,
autoTime: true,
}),
}),
...
...
src/services/authApi.ts
View file @
0396e588
...
@@ -7,7 +7,7 @@ export const authApi = createApi({
...
@@ -7,7 +7,7 @@ export const authApi = createApi({
reducerPath
:
"authApi"
,
reducerPath
:
"authApi"
,
baseQuery
:
baseQuery
,
baseQuery
:
baseQuery
,
endpoints
:
(
builder
)
=>
({
endpoints
:
(
builder
)
=>
({
registerUser
:
builder
.
mutation
<
{
success
:
boolean
,
data
:
LoginResponse
|
null
,
message
:
string
}
,
RegisterProps
>
({
registerUser
:
builder
.
mutation
<
LoginResponse
,
RegisterProps
>
({
query
:
(
body
)
=>
({
query
:
(
body
)
=>
({
url
:
`/api/auth/register`
,
url
:
`/api/auth/register`
,
method
:
"POST"
,
method
:
"POST"
,
...
@@ -63,7 +63,20 @@ export const authApi = createApi({
...
@@ -63,7 +63,20 @@ export const authApi = createApi({
},
},
})
})
}),
}),
getAgeGateUuid
:
builder
.
query
<
GlobalResponse
&
{
data
:
{
age_verify_uuid
:
string
,
is_age_verified
:
boolean
}
},
void
>
({
query
:
()
=>
({
url
:
`/api/user/age-verify`
,
method
:
"GET"
,
})
}),
verifyAgeGate
:
builder
.
mutation
<
GlobalResponse
,
{
age_verify_uuid
:
string
}
>
({
query
:
({
age_verify_uuid
})
=>
({
url
:
`/api/user/age-verify`
,
method
:
"POST"
,
body
:
{
age_verify_uuid
}
})
})
})
})
})
})
export
const
{
useLoginMutation
,
useRegisterUserMutation
,
useSendVerificationLinkAgainMutation
,
useForgotPasswordMutation
,
useVerifyOTPMutation
,
useResetPasswordMutation
,
useVerifyEmailMutation
}
=
authApi
;
export
const
{
useLoginMutation
,
useRegisterUserMutation
,
useSendVerificationLinkAgainMutation
,
useForgotPasswordMutation
,
useVerifyOTPMutation
,
useResetPasswordMutation
,
useVerifyEmailMutation
,
useGetAgeGateUuidQuery
,
useVerifyAgeGateMutation
}
=
authApi
;
\ No newline at end of file
\ No newline at end of file
src/types/auth.ts
View file @
0396e588
...
@@ -25,6 +25,7 @@ export interface LoginResponse {
...
@@ -25,6 +25,7 @@ export interface LoginResponse {
access_token
:
string
,
access_token
:
string
,
// expires_in: 3600,
// expires_in: 3600,
user
:
User
,
user
:
User
,
redirection_link
:
string
;
}
}
message
:
string
message
:
string
}
}
...
...
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