2024-11-05 11:12:42 +00:00
"use strict" ;
exports . id = 8374 ;
exports . ids = [ 8374 ] ;
exports . modules = {
/***/ 8374 :
/***/ ( ( _ _unused _webpack _module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) => {
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
"Z" : ( ) => ( /* binding */ SocialLogin )
} ) ;
// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx _runtime _ = _ _webpack _require _ _ ( 997 ) ;
// EXTERNAL MODULE: external "react"
var external _react _ = _ _webpack _require _ _ ( 6689 ) ;
var external _react _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _react _ ) ;
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
var frontend _fetchApi = _ _webpack _require _ _ ( 6729 ) ;
; // CONCATENATED MODULE: ./components/pages/login/GoogleIdentityButton.jsx
/ * *
* Imports
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* / / * * * * * * * * * * * * * * * * * * * * * * * React / Next Imports * /
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ / * *
* Main Component { Functional }
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* @ param { Object } props - Props from getServerSideProps or getStaticProps
* @ param { import ( "@/package-shared/types" ) . UserType } props . user
* @ param { string } [ props . userType ]
* @ param { React . Dispatch < React . SetStateAction < boolean >> } props . setLoading
* / f u n c t i o n G o o g l e I d e n t i t y B u t t o n ( { u s e r , u s e r T y p e , s e t L o a d i n g } ) {
/ * *
* Get Contexts
*
* @ abstract { React . useContext }
* / / ///////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/ * *
* Javascript Variables
*
* @ abstract Non hook variables and functions
* / if (user?.logged_in_status || user?.current?.logged_in_status) return / * # _ _PURE _ _ * / j s x _ r u n t i m e _ . j s x ( ( e x t e r n a l _ r e a c t _ d e f a u l t ( ) ) . F r a g m e n t , { } ) ;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/ * *
* React Hooks
*
* @ abstract { useState , useEffect , useRef , etc ... }
* / e x t e r n a l _ r e a c t _ d e f a u l t ( ) . u s e E f f e c t ( ( ) = > {
function handleCredentialResponse ( response ) {
window . activeGooglePrompt = false ;
userLoginWithGoogle ( {
gUser : null ,
tokenRes : response . credential ,
setLoading
} ) ;
}
////////////////////////////////////////
google . accounts . id . initialize ( {
2024-11-26 09:31:39 +00:00
client _id : "" ,
2024-11-05 11:12:42 +00:00
callback : handleCredentialResponse
} ) ;
////////////////////////////////////////
google . accounts . id . renderButton ( document . getElementById ( "google-identity-button" ) , {
theme : "outline" ,
size : "large" ,
logo _alignment : "center"
} ) ;
////////////////////////////////////////
// if (user?.logged_in_status || document.cookie.match(/google_prompt_skipped=true/)) {
// google.accounts.id.cancel();
// return;
// }
////////////////////////////////////////
// window.activeGooglePrompt = true;
// google.accounts.id.prompt((notification) => {
// console.log("getMomentType => ", notification.getMomentType());
// console.log("getDismissedReason => ", notification.getDismissedReason());
// console.log("getNotDisplayedReason => ", notification.getNotDisplayedReason());
// console.log("getSkippedReason => ", notification.getSkippedReason());
// console.log("isDismissedMoment => ", notification.isDismissedMoment());
// console.log("isDisplayMoment => ", notification.isDisplayMoment());
// console.log("isDisplayed => ", notification.isDisplayed());
// console.log("isNotDisplayed => ", notification.isNotDisplayed());
// console.log("isSkippedMoment => ", notification.isSkippedMoment());
// if (notification.isSkippedMoment()) {
// document.cookie = "google_prompt_skipped=true;max-age=" + 60000 * 60 * 24 * 5;
// window.activeGooglePrompt = false;
// }
// if (notification.isNotDisplayed()) {
// window.activeGooglePrompt = false;
// }
// }); // also display the One Tap dialog
} , [ ] ) ;
/ * *
* Function Return
*
* @ abstract Main Function Return
* / return / * # _ _PURE _ _ * / j s x _ r u n t i m e _ . j s x ( " d i v " , {
className : "w-full flex items-center justify-center h-[45px] overflow-hidden button outlined normal-weight small-text gray p-0" ,
style : {
padding : 0
} ,
children : /*#__PURE__*/ ( 0 , jsx _runtime _ . jsxs ) ( "div" , {
className : "relative w-full h-full justify-center" ,
children : [
/*#__PURE__*/ ( 0 , jsx _runtime _ . jsxs ) ( "div" , {
className : "w-full h-full justify-center bg-white dark:bg-slate-800 relative z-10 pointer-events-none" ,
style : {
border : "none"
} ,
children : [
/*#__PURE__*/ jsx _runtime _ . jsx ( "img" , {
src : "/images/google.png" ,
width : 18 ,
height : 18 ,
alt : ""
} ) ,
/*#__PURE__*/ jsx _runtime _ . jsx ( "span" , {
children : "Login With Google"
} )
]
} ) ,
/*#__PURE__*/ jsx _runtime _ . jsx ( "div" , {
id : "google-identity-button" ,
className : "w-full absolute justify-center top-0 left-0" ,
style : {
transform : "scale(2)"
}
} )
]
} )
} ) ;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ function userLoginWithGoogle ( { gUser , tokenRes , setLoading } ) {
setLoading ( true ) ;
if ( ! tokenRes ) {
console . log ( "No Token Response received!" ) ;
return closeLoader ( ) ;
}
( 0 , frontend _fetchApi /* default */ . Z ) ( ` /api/social-login/google-auth ${ window . location . search } ` , {
method : "post" ,
body : {
token : tokenRes
}
} ) . then ( async ( res ) => {
if ( res . success && res . user ) {
localStorage . setItem ( "csrf" , res . user . csrf _k ) ;
localStorage . setItem ( "user" , JSON . stringify ( res . user ) ) ;
window . location . reload ( ) ;
} else {
console . log ( res ) ;
setLoading ( false ) ;
if ( res . alert ) {
window . alert ( res . msg ) ;
}
}
} ) . catch ( async ( err ) => {
alert ( "Login Failed" ) ;
console . log ( "Google login fetch error => " , err ) ;
setLoading ( false ) ;
} ) ;
}
// EXTERNAL MODULE: ./functions/frontend/clearCaches.js
var clearCaches = _ _webpack _require _ _ ( 9137 ) ;
; // CONCATENATED MODULE: ./components/pages/login/GithubLogin.jsx
// @ts-check
/ * *
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* Imports
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* /
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
/ * *
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* Main Component { Functional }
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* @ param { Object } props - Props from getServerSideProps or getStaticProps
* @ param { import ( "@/package-shared/types" ) . UserType } [ props . user ]
* @ param { React . Dispatch < React . SetStateAction < boolean >> } props . setLoading
* / f u n c t i o n G i t h u b L o g i n ( { u s e r , s e t L o a d i n g } ) {
/ * *
* Get Contexts
*
* @ abstract { React . useContext }
* / / ///////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/ * *
* Javascript Variables
*
* @ abstract Non hook variables and functions
* / if (user?.logged_in_status) return / * # _ _PURE _ _ * / j s x _ r u n t i m e _ . j s x ( ( e x t e r n a l _ r e a c t _ d e f a u l t ( ) ) . F r a g m e n t , { } ) ;
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/ * *
* React Hooks
*
* @ abstract { useState , useEffect , useRef , etc ... }
* / e x t e r n a l _ r e a c t _ d e f a u l t ( ) . u s e E f f e c t ( ( ) = > {
const urlQuery = window . location . search ;
const urlQueryParams = new URLSearchParams ( urlQuery ) ;
const codeParam = urlQueryParams . get ( "code" ) ;
const emailParam = urlQueryParams . get ( "email" ) ;
if ( codeParam ) {
setLoading ( true ) ;
( 0 , frontend _fetchApi /* default */ . Z ) ( ` /api/social-login/github-auth?code= ${ codeParam } ${ emailParam ? "&email=" + emailParam : "" } ` ) . then ( ( res ) => {
if ( ! res ? . success ) {
if ( res . msg ? . match ( /Github User Email not present/i ) ) {
const enterEmail = window . prompt ( ` Cannot access the email address of this github account. Please enter an email address to continue. ` ) ;
if ( enterEmail && enterEmail ? . match ( /.*@.*\..*/ ) && ! enterEmail ? . match ( / / ) ) {
2024-11-26 09:31:39 +00:00
const newFetchUrl = ` https://github.com/login/oauth/authorize?client_id= ${ "" } &scope=user&redirect_uri= ${ "http://localhost:7070" } ${ window . location . pathname } ?email= ${ enterEmail } ` ;
2024-11-05 11:12:42 +00:00
window . location . assign ( newFetchUrl ) ;
}
}
}
if ( res ? . msg && res ? . alert ) {
window . alert ( res . msg ) ;
}
if ( res ? . success && res ? . user ) {
localStorage . setItem ( "csrf" , res . user . csrf _k ) ;
localStorage . setItem ( "user" , JSON . stringify ( res . user ) ) ;
( 0 , clearCaches /* default */ . Z ) ( ) . then ( ( ) => {
window . location . reload ( ) ;
} ) ;
}
setTimeout ( ( ) => {
setLoading ( false ) ;
} , 1000 ) ;
} ) . catch ( ( error ) => {
console . log ( error ) ;
setTimeout ( ( ) => {
setLoading ( false ) ;
} , 1000 ) ;
} ) ;
}
} , [ ] ) ;
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/ * *
* Function Return
*
* @ abstract Main Function Return
* / return / * # _ _PURE _ _ * / j s x _ r u n t i m e _ . j s x ( " d i v " , {
className : "w-full flex items-center justify-center" ,
children : /*#__PURE__*/ ( 0 , jsx _runtime _ . jsxs ) ( "div" , {
className : "button outlined gray w-full more-padding small-text normal-weight gap-6" ,
onClick : ( e ) => {
setLoading ( true ) ;
2024-11-26 09:31:39 +00:00
const fetchUrl = ` https://github.com/login/oauth/authorize?client_id= ${ "" } &scope=user&redirect_uri= ${ "http://localhost:7070" } ${ window . location . pathname } ` ;
2024-11-05 11:12:42 +00:00
console . log ( fetchUrl ) ;
window . location . assign ( fetchUrl ) ;
// fetch(fetchUrl, {
// headers: {
// "Access-Control-Allow-Origin": "*",
// },
// })
// .then((res) => res.json())
// .then((data) => {
// console.log(data);
// setTimeout(() => {
// setLoading(false);
// }, 1000);
// })
// .catch((error) => {
// console.log(error);
// setTimeout(() => {
// setLoading(false);
// }, 1000);
// });
setTimeout ( ( ) => {
setLoading ( false ) ;
} , 1000 ) ;
// fetchApi(fetchUrl).then((res) => {
// console.log(res);
// setTimeout(() => {
// setLoading(false);
// }, 1000);
// });
} ,
children : [
/*#__PURE__*/ jsx _runtime _ . jsx ( "img" , {
src : "/images/github.png" ,
width : 18 ,
height : 18 ,
alt : "" ,
className : "flex dark:hidden"
} ) ,
/*#__PURE__*/ jsx _runtime _ . jsx ( "img" , {
src : "/images/github-white.png" ,
width : 18 ,
height : 18 ,
alt : "" ,
className : "hidden dark:flex"
} ) ,
/*#__PURE__*/ jsx _runtime _ . jsx ( "span" , {
children : "Login With Github"
} )
]
} )
} ) ;
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
} //////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
; // CONCATENATED MODULE: ./components/pages/login/FacebookSignInButton.jsx
/ * *
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* Imports
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* / / * * * * * * * * * * * * * * * * * * * * * * * React / Next Imports * /
/** ~ End React/Next Imports *************** */ /** ********************* Functions and Other Page Imports */ // import clearCaches from "../functions/frontend/ ";
// import { closeLoader, openLoader } from "./PageLoaderBlock";
/** ~ End Functions and Other Page Imports *************** */ /** ********************* Context Providers */ /** ~ End Context Providers *************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ / * *
* Main Component { Functional }
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* @ param { object } props - React component props object
* @ param { function ( ) : void } props . setLoading - Props from getServerSideProps or getStaticProps
* / f u n c t i o n F a c e b o o k S i g n I n B u t t o n ( { s e t L o a d i n g } ) {
/ * *
* Get Contexts
*
* @ abstract { React . useContext }
* / / ///////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/ * *
* Javascript Variables
*
* @ abstract Non hook variables and functions
* / / ///////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/ * *
* React Hooks
*
* @ abstract { useState , useEffect , useRef , etc ... }
* / l e t [ i s S i g n e d I n , s e t I s S i g n e d I n ] = R e a c t . u s e S t a t e ( f a l s e ) ;
let [ refresh , setRefresh ] = React . useState ( 0 ) ;
React . useEffect ( ( ) => {
// let reloads = localStorage.getItem("login_reloads");
// if (reloads && parseInt(reloads) >= 1) return;
FB . init ( {
2024-11-26 09:31:39 +00:00
appId : "" ,
2024-11-05 11:12:42 +00:00
cookie : true ,
xfbml : true ,
version : "v13.0"
} ) ;
if ( isSignedIn ) return ;
FB . getLoginStatus ( ( response ) => {
// console.log(response);
// if (!response.authResponse) {
// } else
if ( response . status === "connected" ) {
// console.log("Facebook User Signed in");
setIsSignedIn ( true ) ;
userLoginWithFacebook ( response , setIsSignedIn , setLoading ) ;
} else {
setIsSignedIn ( false ) ;
}
} ) ;
} , [
refresh
] ) ;
/ * *
* Function Return
*
* @ abstract Main Function Return
* / return / * # _ _PURE _ _ * / _ j s x ( " d i v " , {
className : "w-full" ,
children : /*#__PURE__*/ _jsxs ( "div" , {
className : "w-full" ,
children : [
! isSignedIn && /*#__PURE__*/ _jsxs ( "div" , {
className : "button outlined gray w-full more-padding normal-weight small-text gap-6" ,
onClick : ( ) => {
if ( setLoading ) setLoading ( true ) ;
FB . login ( ( res ) => {
if ( res . status === "connected" ) {
setIsSignedIn ( true ) ;
userLoginWithFacebook ( res , setIsSignedIn , setLoading ) ;
} else {
if ( setLoading ) setLoading ( false ) ;
}
setRefresh ( ( prev ) => prev + 1 ) ;
} , {
auth _type : "rerequest" ,
scope : "email,public_profile" ,
return _scopes : true ,
enable _profile _selector : true
} ) ;
} ,
children : [
/*#__PURE__*/ _jsx ( "img" , {
src : "/images/facebook.png" ,
width : 18 ,
height : 18 ,
alt : ""
} ) ,
/*#__PURE__*/ _jsx ( "span" , {
children : "Login With Facebook"
} )
]
} ) ,
isSignedIn && /*#__PURE__*/ _jsxs ( "div" , {
className : "button outlined gray w-full pointer-events-none more-padding" ,
onClick : ( ) => {
if ( setLoading ) setLoading ( true ) ;
FB . logout ( ( res ) => {
// console.log(res);
setIsSignedIn ( false ) ;
if ( setLoading ) setLoading ( false ) ;
} ) ;
} ,
children : [
/*#__PURE__*/ _jsx ( "img" , {
src : "/images/facebook.png" ,
width : 20 ,
alt : ""
} ) ,
/*#__PURE__*/ _jsx ( "span" , {
children : "Sign Out of Facebook"
} )
]
} )
]
} )
} ) ;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/ * *
* Facebook Login Function
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* @ param { object } fbUser - React component props object
* @ param { object } fbUser . authResponse - React component props object
* @ param { function ( ) : void } signInDispatch - Set signin status
* @ param { function ( ) : void } setLoading - Set loading function
* / f u n c t i o n u s e r L o g i n W i t h F a c e b o o k ( f b U s e r , s i g n I n D i s p a t c h , s e t L o a d i n g ) {
console . log ( "LOGGING IN WITH FB ..." ) ;
if ( ! fbUser . authResponse ) {
if ( setLoading ) setLoading ( false ) ;
return ;
}
FB . api ( "/me" , {
fields : "first_name,last_name,email,name,picture"
} , async ( response ) => {
/ * *
* React Hooks
*
* @ abstract { useState , useEffect , useRef , etc ... }
* / l e t e x i s t i n g S o c i a l I d = a w a i t f e t c h A p i ( ` / a p i / s o c i a l - l o g i n / u t i l s / c h e c k S o c i a l I d ? s o c i a l _ i d = $ { r e s p o n s e . i d } & s o c i a l _ p l a t f o r m = f a c e b o o k ` ) ;
/ * *
* React Hooks
*
* @ abstract { useState , useEffect , useRef , etc ... }
* / l e t f i n a l E m a i l , s u p E m a i l ;
if ( ! response . email ) {
/ * *
* Get Email Function
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
*
* @ description get email from server
* / a s y n c f u n c t i o n g e t E m a i l ( ) {
if ( existingSocialId . social _id ) {
let existingEmailExistingUser = await fetchApi ( ` /api/social-login/utils/getEmailFromSocialId?social_id= ${ response . id } &social_platform=facebook ` ) ;
finalEmail = existingEmailExistingUser . email ;
return existingEmailExistingUser . email ;
}
let userEmail = window . prompt ( "You have no email linked with this account: please Enter an email address to continue" ) ;
if ( ! userEmail ) {
alert ( "Can't create account without an email address: please provide an email address for easy contact. Thanks." ) ;
return false ;
}
let isEmailValid = userEmail . match ( /.*@.*\..*/ ) ;
if ( ! isEmailValid ) {
alert ( "Email not valid: Please enter a valid email address" ) ;
return await getEmail ( ) ;
}
let existingEmail = await fetchApi ( ` /api/social-login/utils/checkEmail?email= ${ userEmail } ` ) ;
if ( existingEmail ? . email ) {
alert ( "Email already taken: please enter another email address" ) ;
return await getEmail ( ) ;
} else {
supEmail = userEmail ;
return userEmail ;
}
}
let isEmailResolved = await getEmail ( ) ;
if ( isEmailResolved ) {
finalEmail = isEmailResolved ;
} else {
finalEmail = null ;
}
} else {
finalEmail = response . email ;
}
////////////////////////////////////////
if ( ! finalEmail ) {
alert ( "No Email Provided, Please try again" ) ;
if ( setLoading ) setLoading ( false ) ;
return ;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
let usernamEmail = ( ( ) => {
if ( ! response . email ) {
return ` facebook_ ${ response . name . toLowerCase ( ) . replace ( / /g , "-" ) } ` ;
} else {
return ` facebook_ ${ response . email . replace ( /@.*/ , "" ) } ` ;
}
} ) ( ) ;
let fbUserImage = ` https://graph.facebook.com/ ${ response . id } /picture?type=large ` ;
let fbUserImageTiny = response . picture . data . url ;
fetch ( ` /api/social-login/facebook-auth ${ window . location . search } ` , {
method : "post" ,
headers : {
"Content-Type" : "application/json"
} ,
body : JSON . stringify ( {
facebookUserId : response . id ,
facebookUserImage : fbUserImage ,
facebookUserFullName : response . name ,
facebookUserFirstName : response . first _name ,
facebookUserLastName : response . last _name ,
facebookUserEmail : finalEmail ,
supEmail : supEmail
} )
} ) . then ( ( res ) => res . json ( ) ) . then ( async ( data ) => {
signInDispatch ( true ) ;
localStorage . setItem ( "user" , JSON . stringify ( data . user ) ) ;
localStorage . setItem ( "csrf" , JSON . stringify ( data . user . csrf _k ) ) ;
window . location . reload ( ) ;
} ) . catch ( async ( err ) => {
console . log ( err ) ;
signInDispatch ( true ) ;
} ) ;
} ) ;
}
; // CONCATENATED MODULE: ./components/pages/login/SocialLogin.jsx
// @ts-check
/ * *
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* Imports
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* /
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ / * *
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* Main Component { Functional }
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* @ param { Object } props - React component props including { children }
* @ param { any } props . user
* @ param { string } props . userType
* @ param { React . Dispatch < React . SetStateAction < boolean >> } props . setLoading
* / f u n c t i o n S o c i a l L o g i n ( { u s e r , u s e r T y p e , s e t L o a d i n g } ) {
/ * *
* Get Contexts
*
* @ abstract { React . useContext }
* / i f ( t r u e ) {
return null ;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/ * *
* Javascript Variables
*
* @ abstract Non hook variables and functions
* / if (user?.logged_in_status) return / * # _ _PURE _ _ * / j s x _ r u n t i m e _ . j s x ( ( e x t e r n a l _ r e a c t _ d e f a u l t ( ) ) . F r a g m e n t , { } ) ;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/ * *
* React Hooks
*
* @ abstract { useState , useEffect , useRef , etc ... }
* / c o n s t [ g o o g l e L o g i n , s e t G o o g l e L o g i n ] = e x t e r n a l _ r e a c t _ d e f a u l t ( ) . u s e S t a t e ( f a l s e ) ;
// const [facebookLogin, setFacebookLogin] = React.useState(false);
external _react _default ( ) . useEffect ( ( ) => {
if ( ! user ? . logged _in _status ) {
// if (window.location.protocol.match(/https/i)) {
// const facebookScript = document.createElement("script");
// facebookScript.src = `https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v14.0&appId=${process.env.NEXT_PUBLIC_DSQL_FACEBOOK_ID}&autoLogAppEvents=1`;
// facebookScript.className = "social-script-tag";
// facebookScript.crossOrigin = "anonymous";
// document.body.appendChild(facebookScript);
// facebookScript.onload = function (e) {
// // console.log("Facebook SDK loaded");
// setFacebookLogin(true);
// };
// }
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
const googleScript = document . createElement ( "script" ) ;
googleScript . src = "https://accounts.google.com/gsi/client" ;
googleScript . className = "social-script-tag" ;
document . body . appendChild ( googleScript ) ;
googleScript . onload = function ( e ) {
// @ts-ignore
if ( google ) setGoogleLogin ( true ) ;
} ;
////////////////////////////////////////
return function cleanup ( ) {
document . querySelectorAll ( ".social-script-tag" ) ? . forEach ( ( scriptTag ) => {
scriptTag . parentNode ? . removeChild ( scriptTag ) ;
} ) ;
} ;
}
} , [
user
] ) ;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/ * *
* Function Return
*
* @ abstract Main Function Return
* / return / * # _ _PURE _ _ * / ( 0 , j s x _ r u n t i m e _ . j s x s ) ( " d i v " , {
className : "flex flex-col items-stretch gap-3 w-full" ,
children : [
/*#__PURE__*/ jsx _runtime _ . jsx ( GithubLogin , {
user : user ,
setLoading : setLoading
} ) ,
googleLogin && /*#__PURE__*/ jsx _runtime _ . jsx ( GoogleIdentityButton , {
user : user ,
userType : userType ,
setLoading : setLoading
} )
]
} ) ;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ } ) ,
/***/ 9137 :
/***/ ( ( _ _unused _webpack _module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) => {
/* harmony export */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
/* harmony export */ "Z" : ( ) => ( /* binding */ clearCaches )
/* harmony export */ } ) ;
// @ts-check
/ * *
* Clear Caches function
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* / a s y n c f u n c t i o n c l e a r C a c h e s ( ) {
try {
/ * * I n i t i a l i z e
* === === === === === === === === === === === === === === === === === === === === === === === === === ===
* / / * * * * * * * * * * * * * * * * * * * * * * * Variables * / c o n s t k e y s = a w a i t c a c h e s . k e y s ( ) ;
if ( keys [ 0 ] ) {
await Promise . all ( keys . map ( ( key ) => {
return caches . delete ( key ) ;
} ) ) ;
}
} catch ( /** @type {any} */ error ) {
console . log ( "Error in clearing cache =>" , error . message ) ;
}
}
/***/ } )
} ;
;