diff --git a/node_modules/reactjs-social-login/dist/reactjs-social-login.js b/node_modules/reactjs-social-login/dist/reactjs-social-login.js index faee1e0..042e78b 100644 --- a/node_modules/reactjs-social-login/dist/reactjs-social-login.js +++ b/node_modules/reactjs-social-login/dist/reactjs-social-login.js @@ -1 +1 @@ -var e,t=require("react"),o=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function n(){return(n=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var o=0,n=new Array(t);o=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(o=e[Symbol.iterator]()).next.bind(o)}(new URLSearchParams(e));!(t=n()).done;){var i=t.value;o[i[0]]=i[1]}o.access_token?w?C({provider:"github",data:o}):E(o):y("no data")}).catch(function(e){y(e)})}},[a,y,E,C,l,f,u,k,w]),L=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"github"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=t.useCallback(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("github");e&&(L({provider:"github",type:"code",code:e}),localStorage.removeItem("github"))},[L]),I=t.useCallback(function(){S&&S(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://github.com/login/oauth/authorize?client_id="+l+"&scope="+s+"&state="+a+"_github&redirect_uri="+f+"&allow_signup="+v,"Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[s,a,l,f,v,S,j]);return o.createElement("div",{className:m,onClick:I},b)}),m=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.client_id,c=e.client_secret,s=e.className,l=e.redirect_uri,u=e.fields,p=void 0===u?"id,username,account_type,media_count":u,m=e.scope,f=void 0===m?"user_profile,user_media":m,h=e.response_type,v=void 0===h?"code":h,g=e.isOnlyGetCode,w=void 0!==g&&g,_=e.isOnlyGetToken,k=void 0!==_&&_,b=e.children,y=e.onReject,C=e.onResolve,S=e.onLoginStart;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_instagram")&&t&&(localStorage.setItem("instagram",t),window.close())},[]);var E=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://graph.instagram.com//me?fields="+p+"&access_token="+e.access_token,{method:"GET",headers:{"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){C({provider:"instagram",data:n({},t,e)})}).catch(function(e){y(e)})},[p,y,C]),P=t.useCallback(function(e){if(w)C({provider:"instagram",data:{code:e}});else{var t={grant_type:"authorization_code",code:e,redirect_uri:l,client_id:a,client_secret:c},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d});fetch("https://cors.bridged.cc/https://api.instagram.com/oauth/access_token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?k?C({provider:"instagram",data:e}):E(e):y("no data")}).catch(function(e){y(e)}).finally(function(){})}},[y,C,E,a,l,c,w,k]),L=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"instagram"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=t.useCallback(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("instagram");e&&(L({provider:"instagram",type:"code",code:e}),localStorage.removeItem("instagram"))},[L]),I=t.useCallback(function(){S&&S(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://api.instagram.com/oauth/authorize?response_type="+v+"&client_id="+a+"&scope="+f+"&state="+i+"_instagram&redirect_uri="+l,"Instagram","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[f,i,a,l,S,v,j]);return o.createElement("div",{className:s,onClick:I},b)}),f=t.memo(function(e){var r=e.tenant,i=void 0===r?"common":r,a=e.state,c=void 0===a?"":a,s=e.client_id,d=e.className,l=e.redirect_uri,u=e.scope,p=void 0===u?"profile openid email":u,m=e.response_type,f=void 0===m?"code":m,h=e.response_mode,v=void 0===h?"query":h,g=e.children,w=e.code_challenge,_=void 0===w?"19cfc47c216dacba8ca23eeee817603e2ba34fe0976378662ba31688ed302fa9":w,k=e.code_challenge_method,b=void 0===k?"plain":k,y=e.prompt,C=void 0===y?"select_account":y,S=e.isOnlyGetCode,E=void 0!==S&&S,P=e.isOnlyGetToken,L=void 0!==P&&P,j=e.onLoginStart,I=e.onReject,R=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_microsoft")&&t&&(localStorage.setItem("microsoft",t),window.close())},[]);var T=t.useCallback(function(e){fetch("https://graph.microsoft.com/v1.0/me",{method:"GET",headers:{Authorization:"Bearer "+e.access_token}}).then(function(e){return e.json()}).then(function(t){R({provider:"microsoft",data:n({},t,e)})}).catch(function(e){I(e)})},[I,R]),N=t.useCallback(function(e){if(E)R({provider:"microsoft",data:{code:e}});else{var t={code:e,scope:p,client_id:s,redirect_uri:l,code_verifier:_,grant_type:"authorization_code"},o=new Headers({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"});fetch("https://login.microsoftonline.com/"+i+"/oauth2/v2.0/token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?L?R({provider:"microsoft",data:e}):T(e):I("no data")}).catch(function(e){I(e)})}},[p,i,I,T,s,R,l,_,E,L]),z=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"microsoft"===n&&o&&N(o))}catch(e){return Promise.reject(e)}},[N]),x=t.useCallback(function(){window.removeEventListener("storage",x,!1);var e=localStorage.getItem("microsoft");e&&(z({provider:"microsoft",type:"code",code:e}),localStorage.removeItem("microsoft"))},[z]),G=t.useCallback(function(){j&&j(),window.addEventListener("storage",x,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://login.microsoftonline.com/"+i+"/oauth2/v2.0/authorize?client_id="+s+"\n &response_type="+f+"\n &redirect_uri="+l+"\n &response_mode="+v+"\n &scope="+p+"\n &state="+c+"_microsoft\n &prompt="+C+"\n &code_challenge="+_+"\n &code_challenge_method="+b,"Microsoft","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[p,c,C,i,s,j,l,v,f,_,x,b]);return o.createElement("div",{className:d,onClick:G},g)}),h=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.scope,c=void 0===a?"r_liteprofile":a,s=e.client_id,l=e.client_secret,u=e.className,p=void 0===u?"":u,m=e.redirect_uri,f=e.response_type,h=void 0===f?"code":f,v=e.isOnlyGetCode,g=void 0!==v&&v,w=e.isOnlyGetToken,_=void 0!==w&&w,k=e.children,b=e.onLoginStart,y=e.onReject,C=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_linkedin")&&t&&(localStorage.setItem("linkedin",t),window.close())},[]);var S=t.useCallback(function(e){fetch("https://api.allorigins.win/get?url="+encodeURIComponent("https://api.linkedin.com/v2/me?oauth2_access_token="+e.access_token+"&projection=(id,profilePicture(displayImage~digitalmediaAsset:playableStreams),localizedLastName, firstName,lastName,localizedFirstName)"),{method:"GET"}).then(function(e){return e.json()}).then(function(t){var o=n({},e);if(t.contents){var r=JSON.parse(t.contents);"object"==typeof e&&Object.entries(r).map(function(e){o[e[0]]=e[1]})}C({provider:"linkedin",data:o})}).catch(function(e){y(e)})},[y,C]),E=t.useCallback(function(e){if(g)C({provider:"linkedin",data:{code:e}});else{var t={code:e,grant_type:"authorization_code",redirect_uri:m,client_id:s,client_secret:l},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d});fetch("https://cors.bridged.cc/https://www.linkedin.com/oauth/v2/accessToken",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){_?C({provider:"linkedin",data:e}):S(e)}).catch(function(e){y(e)})}},[y,C,s,S,m,l,g,_]),P=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"linkedin"===n&&o&&E(o))}catch(e){return Promise.reject(e)}},[E]),L=t.useCallback(function(){window.removeEventListener("storage",L,!1);var e=localStorage.getItem("linkedin");e&&(P({provider:"linkedin",type:"code",code:e}),localStorage.removeItem("linkedin"))},[P]),j=t.useCallback(function(){b&&b(),window.addEventListener("storage",L,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.linkedin.com/oauth/v2/authorization?response_type="+h+"&client_id="+s+"&scope="+c+"&state="+i+"_linkedin&redirect_uri="+m,"Linkedin","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[b,L,h,s,c,i,m]);return o.createElement("div",{className:p,onClick:j},k)}),v=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.scope,c=void 0===a?"boards:read,pins:read,user_accounts:read":a,s=e.client_id,l=e.client_secret,u=e.className,p=void 0===u?"":u,m=e.redirect_uri,f=e.isOnlyGetCode,h=void 0!==f&&f,v=e.isOnlyGetToken,g=void 0!==v&&v,w=e.children,_=e.onLoginStart,k=e.onReject,b=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_pinterest")&&t&&(localStorage.setItem("pinterest",t),window.close())},[]);var y=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/user_account",{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){b({provider:"pinterest",data:n({},e,t)})}).catch(function(e){return k(e)})},[k,b]),C=t.useCallback(function(e){try{var t=function(){if(!h){var t={code:e,redirect_uri:m,grant_type:"authorization_code"},o=[];for(var n in t){var r=encodeURIComponent(n),i=encodeURIComponent(t[n]);o.push(r+"="+i)}return o=o.join("&"),Promise.resolve(fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/oauth/token",{method:"POST",headers:{Authorization:"Basic "+btoa(s+":"+l),"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d},body:o}).then(function(e){return e.json()}).catch(function(e){return k(e)})).then(function(e){e.access_token&&(g?b({provider:"pinterest",data:e}):y(e))})}b({provider:"pinterest",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[k,s,y,b,m,l,h,g]),S=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"pinterest"===n&&o&&C(o))}catch(e){return Promise.reject(e)}},[C]),E=t.useCallback(function(){window.removeEventListener("storage",E,!1);var e=localStorage.getItem("pinterest");e&&(S({provider:"pinterest",type:"code",code:e}),localStorage.removeItem("pinterest"))},[S]),P=t.useCallback(function(){_&&_(),window.addEventListener("storage",E,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.pinterest.com/oauth/?client_id="+s+"&scope="+c+"&state="+i+"_pinterest&redirect_uri="+m+"&response_type=code","Pinterest","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[c,i,s,m,_,E]);return o.createElement("div",{className:p,onClick:P},w)}),g=t.memo(function(e){var r=e.client_id,i=e.className,a=void 0===i?"":i,c=e.redirect_uri,s=e.children,l=e.fields,u=void 0===l?"created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld":l,p=e.state,m=void 0===p?"state":p,f=e.scope,h=void 0===f?"users.read%20tweet.read":f,v=e.isOnlyGetCode,g=void 0!==v&&v,w=e.isOnlyGetToken,_=void 0!==w&&w,k=e.onLoginStart,b=e.onReject,y=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code");e.searchParams.get("state")&&t&&(localStorage.setItem("twitter",""+t),window.close())},[]);var C=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://api.twitter.com/2/users/me?user.fields="+u,{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){y({provider:"twitter",data:n({},e,t.data)})}).catch(function(e){return b(e)})},[u,b,y]),S=t.useCallback(function(e){try{var t=function(){if(!g){var t=new URLSearchParams({code:e,redirect_uri:c,client_id:r,grant_type:"authorization_code",code_verifier:"challenge"});return Promise.resolve(fetch("https://cors.bridged.cc/https://api.twitter.com/2/oauth2/token",{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d}}).then(function(e){return e.json()}).catch(function(e){return b(e)})).then(function(e){e.access_token&&(_?y({provider:"twitter",data:e}):C(e))})}y({provider:"twitter",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,C,y,r,c,g,_]),E=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"twitter"===n&&o&&S(o))}catch(e){return Promise.reject(e)}},[S]),P=t.useCallback(function(){window.removeEventListener("storage",P,!1);var e=localStorage.getItem("twitter");e&&(E({provider:"twitter",type:"code",code:e}),localStorage.removeItem("twitter"))},[E]),L=t.useCallback(function(){try{k&&k(),window.addEventListener("storage",P,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;return window.open("https://twitter.com/i/oauth2/authorize?response_type=code&client_id="+r+"&redirect_uri="+c+"&scope="+h+"&state="+m+"&code_challenge=challenge&code_challenge_method=plain","twitter","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e),Promise.resolve()}catch(e){return Promise.reject(e)}},[h,m,r,k,c,P]);return o.createElement("div",{className:a,onClick:L},s)});"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var w=window,_=t.memo(function(e){var n=e.client_id,r=e.scope,i=void 0===r?"name email":r,a=e.className,c=void 0===a?"":a,s=e.onLoginStart,d=e.onReject,l=e.onResolve,u=e.redirect_uri,p=void 0===u?"/":u,m=e.children,f=t.useRef(null),h=t.useState(!1),v=h[0],g=h[1];t.useEffect(function(){!v&&y()},[v]),t.useEffect(function(){return function(){f.current&&f.current.remove()}},[]);var _=t.useCallback(function(){return!!document.getElementById("apple-login")},[]),k=t.useCallback(function(e,t,o,n,r){void 0===t&&(t="script");var i=e.createElement(t);i.id=o,i.src=n,i.async=!0,i.defer=!0;var a=document.getElementsByTagName("script")[0];f.current=i,a&&a.parentNode&&a.parentNode.insertBefore(i,a),i.onload=r},[]),b=t.useCallback(function(e){l({provider:"apple",data:e})},[l]),y=t.useCallback(function(){_()?g(!0):k(document,"script","apple-login","https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",function(){w.AppleID.auth.init({clientId:n,scope:i,redirectURI:p,state:"origin:web",usePopup:!0}),g(!0)})},[i,n,p,k,_]),C=t.useCallback(function(){try{if(!v)return Promise.resolve();var e=function(){if(w.AppleID){s&&s();var e=function(e,t){try{var o=Promise.resolve(w.AppleID.auth.signIn()).then(function(e){b(e)})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){d({err:e})});if(e&&e.then)return e.then(function(){})}else y(),d("Apple SDK isn't loaded!")}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,v,y,s,d]);return o.createElement("div",{className:c,onClick:C},m)}),k=t.memo(function(e){var n=e.state,r=void 0===n?"":n,i=e.scope,a=void 0===i?"user.info.basic":i,c=e.client_key,s=e.className,d=void 0===s?"":s,l=e.redirect_uri,u=e.children,p=e.onResolve,m=e.onLoginStart;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_tiktok")&&t&&(localStorage.setItem("tiktok",t),window.close())},[]);var f=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"tiktok"===n&&o&&p({provider:"tiktok",data:{code:o}}))}catch(e){return Promise.reject(e)}},[p]),h=t.useCallback(function(){window.removeEventListener("storage",h,!1);var e=localStorage.getItem("tiktok");e&&(f({provider:"tiktok",type:"code",code:e}),localStorage.removeItem("instagram"))},[f]),v=t.useCallback(function(){m&&m(),window.addEventListener("storage",h,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.tiktok.com/auth/authorize?client_key="+c+"&scope="+a+"&state="+r+"_tiktok&redirect_uri="+l+"&response_type=code","Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[a,r,c,l,m,h]);return o.createElement("div",{className:d,onClick:v},u)});exports.LoginSocialAmazon=a,exports.LoginSocialApple=_,exports.LoginSocialFacebook=s,exports.LoginSocialGithub=p,exports.LoginSocialGoogle=u,exports.LoginSocialInstagram=m,exports.LoginSocialLinkedin=h,exports.LoginSocialMicrosoft=f,exports.LoginSocialPinterest=v,exports.LoginSocialTiktok=k,exports.LoginSocialTwitter=g; +var e,t=require("react"),o=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function n(){return(n=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var o=0,n=new Array(t);o=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(o=e[Symbol.iterator]()).next.bind(o)}(new URLSearchParams(e));!(t=n()).done;){var i=t.value;o[i[0]]=i[1]}o.access_token?w?C({provider:"github",data:o}):E(o):y("no data")}).catch(function(e){y(e)})}},[a,y,E,C,l,f,u,k,w]),L=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"github"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=t.useCallback(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("github");e&&(L({provider:"github",type:"code",code:e}),localStorage.removeItem("github"))},[L]),I=t.useCallback(function(){S&&S(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://github.com/login/oauth/authorize?client_id="+l+"&scope="+s+"&state="+a+"_github&redirect_uri="+f+"&allow_signup="+v,"Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[s,a,l,f,v,S,j]);return o.createElement("div",{className:m,onClick:I},b)}),m=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.client_id,c=e.client_secret,s=e.className,l=e.redirect_uri,u=e.fields,p=void 0===u?"id,username,account_type,media_count":u,m=e.scope,f=void 0===m?"user_profile,user_media":m,h=e.response_type,v=void 0===h?"code":h,g=e.isOnlyGetCode,w=void 0!==g&&g,_=e.isOnlyGetToken,k=void 0!==_&&_,b=e.children,y=e.onReject,C=e.onResolve,S=e.onLoginStart;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_instagram")&&t&&(localStorage.setItem("instagram",t),window.close())},[]);var E=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://graph.instagram.com//me?fields="+p+"&access_token="+e.access_token,{method:"GET",headers:{"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){C({provider:"instagram",data:n({},t,e)})}).catch(function(e){y(e)})},[p,y,C]),P=t.useCallback(function(e){if(w)C({provider:"instagram",data:{code:e}});else{var t={grant_type:"authorization_code",code:e,redirect_uri:l,client_id:a,client_secret:c},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d});fetch("https://cors.bridged.cc/https://api.instagram.com/oauth/access_token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?k?C({provider:"instagram",data:e}):E(e):y("no data")}).catch(function(e){y(e)}).finally(function(){})}},[y,C,E,a,l,c,w,k]),L=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"instagram"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=t.useCallback(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("instagram");e&&(L({provider:"instagram",type:"code",code:e}),localStorage.removeItem("instagram"))},[L]),I=t.useCallback(function(){S&&S(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://api.instagram.com/oauth/authorize?response_type="+v+"&client_id="+a+"&scope="+f+"&state="+i+"_instagram&redirect_uri="+l,"Instagram","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[f,i,a,l,S,v,j]);return o.createElement("div",{className:s,onClick:I},b)}),f=t.memo(function(e){var r=e.tenant,i=void 0===r?"common":r,a=e.state,c=void 0===a?"":a,s=e.client_id,d=e.className,l=e.redirect_uri,u=e.scope,p=void 0===u?"profile openid email":u,m=e.response_type,f=void 0===m?"code":m,h=e.response_mode,v=void 0===h?"query":h,g=e.children,w=e.code_challenge,_=void 0===w?"19cfc47c216dacba8ca23eeee817603e2ba34fe0976378662ba31688ed302fa9":w,k=e.code_challenge_method,b=void 0===k?"plain":k,y=e.prompt,C=void 0===y?"select_account":y,S=e.isOnlyGetCode,E=void 0!==S&&S,P=e.isOnlyGetToken,L=void 0!==P&&P,j=e.onLoginStart,I=e.onReject,R=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_microsoft")&&t&&(localStorage.setItem("microsoft",t),window.close())},[]);var T=t.useCallback(function(e){fetch("https://graph.microsoft.com/v1.0/me",{method:"GET",headers:{Authorization:"Bearer "+e.access_token}}).then(function(e){return e.json()}).then(function(t){R({provider:"microsoft",data:n({},t,e)})}).catch(function(e){I(e)})},[I,R]),N=t.useCallback(function(e){if(E)R({provider:"microsoft",data:{code:e}});else{var t={code:e,scope:p,client_id:s,redirect_uri:l,code_verifier:_,grant_type:"authorization_code"},o=new Headers({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"});fetch("https://login.microsoftonline.com/"+i+"/oauth2/v2.0/token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?L?R({provider:"microsoft",data:e}):T(e):I("no data")}).catch(function(e){I(e)})}},[p,i,I,T,s,R,l,_,E,L]),z=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"microsoft"===n&&o&&N(o))}catch(e){return Promise.reject(e)}},[N]),x=t.useCallback(function(){window.removeEventListener("storage",x,!1);var e=localStorage.getItem("microsoft");e&&(z({provider:"microsoft",type:"code",code:e}),localStorage.removeItem("microsoft"))},[z]),G=t.useCallback(function(){j&&j(),window.addEventListener("storage",x,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://login.microsoftonline.com/"+i+"/oauth2/v2.0/authorize?client_id="+s+"\n &response_type="+f+"\n &redirect_uri="+l+"\n &response_mode="+v+"\n &scope="+p+"\n &state="+c+"_microsoft\n &prompt="+C+"\n &code_challenge="+_+"\n &code_challenge_method="+b,"Microsoft","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[p,c,C,i,s,j,l,v,f,_,x,b]);return o.createElement("div",{className:d,onClick:G},g)}),h=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.scope,c=void 0===a?"r_liteprofile":a,s=e.client_id,l=e.client_secret,u=e.className,p=void 0===u?"":u,m=e.redirect_uri,f=e.response_type,h=void 0===f?"code":f,v=e.isOnlyGetCode,g=void 0!==v&&v,w=e.isOnlyGetToken,_=void 0!==w&&w,k=e.children,b=e.onLoginStart,y=e.onReject,C=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_linkedin")&&t&&(localStorage.setItem("linkedin",t),window.close())},[]);var S=t.useCallback(function(e){fetch("https://api.allorigins.win/get?url="+encodeURIComponent("https://api.linkedin.com/v2/me?oauth2_access_token="+e.access_token+"&projection=(id,profilePicture(displayImage~digitalmediaAsset:playableStreams),localizedLastName, firstName,lastName,localizedFirstName)"),{method:"GET"}).then(function(e){return e.json()}).then(function(t){var o=n({},e);if(t.contents){var r=JSON.parse(t.contents);"object"==typeof e&&Object.entries(r).map(function(e){o[e[0]]=e[1]})}C({provider:"linkedin",data:o})}).catch(function(e){y(e)})},[y,C]),E=t.useCallback(function(e){if(g)C({provider:"linkedin",data:{code:e}});else{var t={code:e,grant_type:"authorization_code",redirect_uri:m,client_id:s,client_secret:l},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d});fetch("https://cors.bridged.cc/https://www.linkedin.com/oauth/v2/accessToken",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){_?C({provider:"linkedin",data:e}):S(e)}).catch(function(e){y(e)})}},[y,C,s,S,m,l,g,_]),P=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"linkedin"===n&&o&&E(o))}catch(e){return Promise.reject(e)}},[E]),L=t.useCallback(function(){window.removeEventListener("storage",L,!1);var e=localStorage.getItem("linkedin");e&&(P({provider:"linkedin",type:"code",code:e}),localStorage.removeItem("linkedin"))},[P]),j=t.useCallback(function(){b&&b(),window.addEventListener("storage",L,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.linkedin.com/oauth/v2/authorization?response_type="+h+"&client_id="+s+"&scope="+c+"&state="+i+"_linkedin&redirect_uri="+m,"Linkedin","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[b,L,h,s,c,i,m]);return o.createElement("div",{className:p,onClick:j},k)}),v=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.scope,c=void 0===a?"boards:read,pins:read,user_accounts:read":a,s=e.client_id,l=e.client_secret,u=e.className,p=void 0===u?"":u,m=e.redirect_uri,f=e.isOnlyGetCode,h=void 0!==f&&f,v=e.isOnlyGetToken,g=void 0!==v&&v,w=e.children,_=e.onLoginStart,k=e.onReject,b=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_pinterest")&&t&&(localStorage.setItem("pinterest",t),window.close())},[]);var y=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/user_account",{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){b({provider:"pinterest",data:n({},e,t)})}).catch(function(e){return k(e)})},[k,b]),C=t.useCallback(function(e){try{var t=function(){if(!h){var t={code:e,redirect_uri:m,grant_type:"authorization_code"},o=[];for(var n in t){var r=encodeURIComponent(n),i=encodeURIComponent(t[n]);o.push(r+"="+i)}return o=o.join("&"),Promise.resolve(fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/oauth/token",{method:"POST",headers:{Authorization:"Basic "+btoa(s+":"+l),"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d},body:o}).then(function(e){return e.json()}).catch(function(e){return k(e)})).then(function(e){e.access_token&&(g?b({provider:"pinterest",data:e}):y(e))})}b({provider:"pinterest",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[k,s,y,b,m,l,h,g]),S=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"pinterest"===n&&o&&C(o))}catch(e){return Promise.reject(e)}},[C]),E=t.useCallback(function(){window.removeEventListener("storage",E,!1);var e=localStorage.getItem("pinterest");e&&(S({provider:"pinterest",type:"code",code:e}),localStorage.removeItem("pinterest"))},[S]),P=t.useCallback(function(){_&&_(),window.addEventListener("storage",E,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.pinterest.com/oauth/?client_id="+s+"&scope="+c+"&state="+i+"_pinterest&redirect_uri="+m+"&response_type=code","Pinterest","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[c,i,s,m,_,E]);return o.createElement("div",{className:p,onClick:P},w)}),g=t.memo(function(e){var r=e.client_id,i=e.className,a=void 0===i?"":i,c=e.redirect_uri,s=e.children,l=e.fields,u=void 0===l?"created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld":l,p=e.state,m=void 0===p?"state":p,f=e.scope,h=void 0===f?"users.read%20tweet.read":f,v=e.isOnlyGetCode,g=void 0!==v&&v,w=e.isOnlyGetToken,_=void 0!==w&&w,k=e.onLoginStart,b=e.onReject,y=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code");e.searchParams.get("state")&&t&&(localStorage.setItem("twitter",""+t),window.close())},[]);var C=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://api.twitter.com/2/users/me?user.fields="+u,{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){y({provider:"twitter",data:n({},e,t.data)})}).catch(function(e){return b(e)})},[u,b,y]),S=t.useCallback(function(e){try{var t=function(){if(!g){var t=new URLSearchParams({code:e,redirect_uri:c,client_id:r,grant_type:"authorization_code",code_verifier:"challenge"});return Promise.resolve(fetch("https://cors.bridged.cc/https://api.twitter.com/2/oauth2/token",{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d}}).then(function(e){return e.json()}).catch(function(e){return b(e)})).then(function(e){e.access_token&&(_?y({provider:"twitter",data:e}):C(e))})}y({provider:"twitter",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,C,y,r,c,g,_]),E=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"twitter"===n&&o&&S(o))}catch(e){return Promise.reject(e)}},[S]),P=t.useCallback(function(){window.removeEventListener("storage",P,!1);var e=localStorage.getItem("twitter");e&&(E({provider:"twitter",type:"code",code:e}),localStorage.removeItem("twitter"))},[E]),L=t.useCallback(function(){try{k&&k(),window.addEventListener("storage",P,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;return window.open("https://twitter.com/i/oauth2/authorize?response_type=code&client_id="+r+"&redirect_uri="+c+"&scope="+h+"&state="+m+"&code_challenge=challenge&code_challenge_method=plain","twitter","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e),Promise.resolve()}catch(e){return Promise.reject(e)}},[h,m,r,k,c,P]);return o.createElement("div",{className:a,onClick:L},s)});"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var w=window,_=t.memo(function(e){var n=e.client_id,r=e.scope,i=void 0===r?"name email":r,a=e.className,c=void 0===a?"":a,s=e.onLoginStart,d=e.onReject,l=e.onResolve,u=e.redirect_uri,p=void 0===u?"/":u,m=e.children,f=t.useRef(null),h=t.useState(!1),v=h[0],g=h[1];t.useEffect(function(){!v&&y()},[v]),t.useEffect(function(){return function(){f.current&&f.current.remove()}},[]);var _=t.useCallback(function(){return!!document.getElementById("apple-login")},[]),k=t.useCallback(function(e,t,o,n,r){void 0===t&&(t="script");var i=e.createElement(t);i.id=o,i.src=n,i.async=!0,i.defer=!0;var a=document.getElementsByTagName("script")[0];f.current=i,a&&a.parentNode&&a.parentNode.insertBefore(i,a),i.onload=r},[]),b=t.useCallback(function(e){l({provider:"apple",data:e})},[l]),y=t.useCallback(function(){_()?g(!0):k(document,"script","apple-login","https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",function(){w.AppleID.auth.init({clientId:n,scope:i,redirectURI:p,state:"origin:web",usePopup:!0}),g(!0)})},[i,n,p,k,_]),C=t.useCallback(function(){try{if(!v)return Promise.resolve();var e=function(){if(w.AppleID){s&&s();var e=function(e,t){try{var o=Promise.resolve(w.AppleID.auth.signIn()).then(function(e){b(e)})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){d({err:e})});if(e&&e.then)return e.then(function(){})}else y(),d("Apple SDK isn't loaded!")}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,v,y,s,d]);return o.createElement("div",{className:c,onClick:C},m)}),k=t.memo(function(e){var n=e.state,r=void 0===n?"":n,i=e.scope,a=void 0===i?"user.info.basic":i,c=e.client_key,s=e.className,d=void 0===s?"":s,l=e.redirect_uri,u=e.children,p=e.onResolve,m=e.onLoginStart;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_tiktok")&&t&&(localStorage.setItem("tiktok",t),window.close())},[]);var f=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"tiktok"===n&&o&&p({provider:"tiktok",data:{code:o}}))}catch(e){return Promise.reject(e)}},[p]),h=t.useCallback(function(){window.removeEventListener("storage",h,!1);var e=localStorage.getItem("tiktok");e&&(f({provider:"tiktok",type:"code",code:e}),localStorage.removeItem("instagram"))},[f]),v=t.useCallback(function(){m&&m(),window.addEventListener("storage",h,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.tiktok.com/v2/auth/authorize/?client_key="+c+"&scope="+a+"&state="+r+"_tiktok&redirect_uri="+l+"&response_type=code","Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[a,r,c,l,m,h]);return o.createElement("div",{className:d,onClick:v},u)});exports.LoginSocialAmazon=a,exports.LoginSocialApple=_,exports.LoginSocialFacebook=s,exports.LoginSocialGithub=p,exports.LoginSocialGoogle=u,exports.LoginSocialInstagram=m,exports.LoginSocialLinkedin=h,exports.LoginSocialMicrosoft=f,exports.LoginSocialPinterest=v,exports.LoginSocialTiktok=k,exports.LoginSocialTwitter=g; diff --git a/node_modules/reactjs-social-login/dist/reactjs-social-login.modern.js b/node_modules/reactjs-social-login/dist/reactjs-social-login.modern.js index dac0438..3299c26 100644 --- a/node_modules/reactjs-social-login/dist/reactjs-social-login.modern.js +++ b/node_modules/reactjs-social-login/dist/reactjs-social-login.modern.js @@ -1 +1 @@ -import e,{memo as t,useRef as o,useState as n,useEffect as r,useCallback as i}from"react";function c(){return(c=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var o=0,n=new Array(t);o=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(o=e[Symbol.iterator]()).next.bind(o)}(new URLSearchParams(e));!(t=n()).done;){var r=t.value;o[r[0]]=r[1]}o.access_token?_?P({provider:"github",data:o}):j(o):S("no data")}).catch(function(e){S(e)})}},[n,S,j,P,l,v,u,k,_]),I=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"github"===n&&o&&E(o))}catch(e){return Promise.reject(e)}},[E]),T=i(function(){window.removeEventListener("storage",T,!1);var e=localStorage.getItem("github");e&&(I({provider:"github",type:"code",code:e}),localStorage.removeItem("github"))},[I]),R=i(function(){L&&L(),window.addEventListener("storage",T,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://github.com/login/oauth/authorize?client_id="+l+"&scope="+d+"&state="+n+"_github&redirect_uri="+v+"&allow_signup="+g,"Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[d,n,l,v,g,L,T]);return e.createElement("div",{className:m,onClick:R},b)}),f=t(function(t){var o=t.state,n=void 0===o?"":o,a=t.client_id,s=t.client_secret,d=t.className,l=t.redirect_uri,u=t.fields,h=void 0===u?"id,username,account_type,media_count":u,m=t.scope,v=void 0===m?"user_profile,user_media":m,f=t.response_type,g=void 0===f?"code":f,w=t.isOnlyGetCode,_=void 0!==w&&w,y=t.isOnlyGetToken,k=void 0!==y&&y,b=t.children,S=t.onReject,P=t.onResolve,L=t.onLoginStart;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_instagram")&&t&&(localStorage.setItem("instagram",t),window.close())},[]);var j=i(function(e){fetch("https://cors.bridged.cc/https://graph.instagram.com//me?fields="+h+"&access_token="+e.access_token,{method:"GET",headers:{"x-cors-grida-api-key":p}}).then(function(e){return e.json()}).then(function(t){P({provider:"instagram",data:c({},t,e)})}).catch(function(e){S(e)})},[h,S,P]),E=i(function(e){if(_)P({provider:"instagram",data:{code:e}});else{var t={grant_type:"authorization_code",code:e,redirect_uri:l,client_id:a,client_secret:s},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":p});fetch("https://cors.bridged.cc/https://api.instagram.com/oauth/access_token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?k?P({provider:"instagram",data:e}):j(e):S("no data")}).catch(function(e){S(e)}).finally(function(){})}},[S,P,j,a,l,s,_,k]),I=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"instagram"===n&&o&&E(o))}catch(e){return Promise.reject(e)}},[E]),T=i(function(){window.removeEventListener("storage",T,!1);var e=localStorage.getItem("instagram");e&&(I({provider:"instagram",type:"code",code:e}),localStorage.removeItem("instagram"))},[I]),R=i(function(){L&&L(),window.addEventListener("storage",T,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://api.instagram.com/oauth/authorize?response_type="+g+"&client_id="+a+"&scope="+v+"&state="+n+"_instagram&redirect_uri="+l,"Instagram","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[v,n,a,l,L,g,T]);return e.createElement("div",{className:d,onClick:R},b)}),g=t(function(t){var o=t.tenant,n=void 0===o?"common":o,a=t.state,s=void 0===a?"":a,d=t.client_id,l=t.className,u=t.redirect_uri,p=t.scope,h=void 0===p?"profile openid email":p,m=t.response_type,v=void 0===m?"code":m,f=t.response_mode,g=void 0===f?"query":f,w=t.children,_=t.code_challenge,y=void 0===_?"19cfc47c216dacba8ca23eeee817603e2ba34fe0976378662ba31688ed302fa9":_,k=t.code_challenge_method,b=void 0===k?"plain":k,S=t.prompt,P=void 0===S?"select_account":S,L=t.isOnlyGetCode,j=void 0!==L&&L,E=t.isOnlyGetToken,I=void 0!==E&&E,T=t.onLoginStart,R=t.onReject,N=t.onResolve;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_microsoft")&&t&&(localStorage.setItem("microsoft",t),window.close())},[]);var z=i(function(e){fetch("https://graph.microsoft.com/v1.0/me",{method:"GET",headers:{Authorization:"Bearer "+e.access_token}}).then(function(e){return e.json()}).then(function(t){N({provider:"microsoft",data:c({},t,e)})}).catch(function(e){R(e)})},[R,N]),C=i(function(e){if(j)N({provider:"microsoft",data:{code:e}});else{var t={code:e,scope:h,client_id:d,redirect_uri:u,code_verifier:y,grant_type:"authorization_code"},o=new Headers({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"});fetch("https://login.microsoftonline.com/"+n+"/oauth2/v2.0/token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?I?N({provider:"microsoft",data:e}):z(e):R("no data")}).catch(function(e){R(e)})}},[h,n,R,z,d,N,u,y,j,I]),G=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"microsoft"===n&&o&&C(o))}catch(e){return Promise.reject(e)}},[C]),O=i(function(){window.removeEventListener("storage",O,!1);var e=localStorage.getItem("microsoft");e&&(G({provider:"microsoft",type:"code",code:e}),localStorage.removeItem("microsoft"))},[G]),x=i(function(){T&&T(),window.addEventListener("storage",O,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://login.microsoftonline.com/"+n+"/oauth2/v2.0/authorize?client_id="+d+"\n &response_type="+v+"\n &redirect_uri="+u+"\n &response_mode="+g+"\n &scope="+h+"\n &state="+s+"_microsoft\n &prompt="+P+"\n &code_challenge="+y+"\n &code_challenge_method="+b,"Microsoft","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[h,s,P,n,d,T,u,g,v,y,O,b]);return e.createElement("div",{className:l,onClick:x},w)}),w=t(function(t){var o=t.state,n=void 0===o?"":o,a=t.scope,s=void 0===a?"r_liteprofile":a,d=t.client_id,l=t.client_secret,u=t.className,h=void 0===u?"":u,m=t.redirect_uri,v=t.response_type,f=void 0===v?"code":v,g=t.isOnlyGetCode,w=void 0!==g&&g,_=t.isOnlyGetToken,y=void 0!==_&&_,k=t.children,b=t.onLoginStart,S=t.onReject,P=t.onResolve;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_linkedin")&&t&&(localStorage.setItem("linkedin",t),window.close())},[]);var L=i(function(e){fetch("https://api.allorigins.win/get?url="+encodeURIComponent("https://api.linkedin.com/v2/me?oauth2_access_token="+e.access_token+"&projection=(id,profilePicture(displayImage~digitalmediaAsset:playableStreams),localizedLastName, firstName,lastName,localizedFirstName)"),{method:"GET"}).then(function(e){return e.json()}).then(function(t){var o=c({},e);if(t.contents){var n=JSON.parse(t.contents);"object"==typeof e&&Object.entries(n).map(function(e){o[e[0]]=e[1]})}P({provider:"linkedin",data:o})}).catch(function(e){S(e)})},[S,P]),j=i(function(e){if(w)P({provider:"linkedin",data:{code:e}});else{var t={code:e,grant_type:"authorization_code",redirect_uri:m,client_id:d,client_secret:l},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":p});fetch("https://cors.bridged.cc/https://www.linkedin.com/oauth/v2/accessToken",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){y?P({provider:"linkedin",data:e}):L(e)}).catch(function(e){S(e)})}},[S,P,d,L,m,l,w,y]),E=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"linkedin"===n&&o&&j(o))}catch(e){return Promise.reject(e)}},[j]),I=i(function(){window.removeEventListener("storage",I,!1);var e=localStorage.getItem("linkedin");e&&(E({provider:"linkedin",type:"code",code:e}),localStorage.removeItem("linkedin"))},[E]),T=i(function(){b&&b(),window.addEventListener("storage",I,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.linkedin.com/oauth/v2/authorization?response_type="+f+"&client_id="+d+"&scope="+s+"&state="+n+"_linkedin&redirect_uri="+m,"Linkedin","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[b,I,f,d,s,n,m]);return e.createElement("div",{className:h,onClick:T},k)}),_=t(function(t){var o=t.state,n=void 0===o?"":o,a=t.scope,s=void 0===a?"boards:read,pins:read,user_accounts:read":a,d=t.client_id,l=t.client_secret,u=t.className,h=void 0===u?"":u,m=t.redirect_uri,v=t.isOnlyGetCode,f=void 0!==v&&v,g=t.isOnlyGetToken,w=void 0!==g&&g,_=t.children,y=t.onLoginStart,k=t.onReject,b=t.onResolve;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_pinterest")&&t&&(localStorage.setItem("pinterest",t),window.close())},[]);var S=i(function(e){fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/user_account",{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":p}}).then(function(e){return e.json()}).then(function(t){b({provider:"pinterest",data:c({},e,t)})}).catch(function(e){return k(e)})},[k,b]),P=i(function(e){try{var t=function(){if(!f){var t={code:e,redirect_uri:m,grant_type:"authorization_code"},o=[];for(var n in t){var r=encodeURIComponent(n),i=encodeURIComponent(t[n]);o.push(r+"="+i)}return o=o.join("&"),Promise.resolve(fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/oauth/token",{method:"POST",headers:{Authorization:"Basic "+btoa(d+":"+l),"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":p},body:o}).then(function(e){return e.json()}).catch(function(e){return k(e)})).then(function(e){e.access_token&&(w?b({provider:"pinterest",data:e}):S(e))})}b({provider:"pinterest",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[k,d,S,b,m,l,f,w]),L=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"pinterest"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=i(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("pinterest");e&&(L({provider:"pinterest",type:"code",code:e}),localStorage.removeItem("pinterest"))},[L]),E=i(function(){y&&y(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.pinterest.com/oauth/?client_id="+d+"&scope="+s+"&state="+n+"_pinterest&redirect_uri="+m+"&response_type=code","Pinterest","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[s,n,d,m,y,j]);return e.createElement("div",{className:h,onClick:E},_)}),y=t(function(t){var o=t.client_id,n=t.className,a=void 0===n?"":n,s=t.redirect_uri,d=t.children,l=t.fields,u=void 0===l?"created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld":l,h=t.state,m=void 0===h?"state":h,v=t.scope,f=void 0===v?"users.read%20tweet.read":v,g=t.isOnlyGetCode,w=void 0!==g&&g,_=t.isOnlyGetToken,y=void 0!==_&&_,k=t.onLoginStart,b=t.onReject,S=t.onResolve;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code");e.searchParams.get("state")&&t&&(localStorage.setItem("twitter",""+t),window.close())},[]);var P=i(function(e){fetch("https://cors.bridged.cc/https://api.twitter.com/2/users/me?user.fields="+u,{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":p}}).then(function(e){return e.json()}).then(function(t){S({provider:"twitter",data:c({},e,t.data)})}).catch(function(e){return b(e)})},[u,b,S]),L=i(function(e){try{var t=function(){if(!w){var t=new URLSearchParams({code:e,redirect_uri:s,client_id:o,grant_type:"authorization_code",code_verifier:"challenge"});return Promise.resolve(fetch("https://cors.bridged.cc/https://api.twitter.com/2/oauth2/token",{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":p}}).then(function(e){return e.json()}).catch(function(e){return b(e)})).then(function(e){e.access_token&&(y?S({provider:"twitter",data:e}):P(e))})}S({provider:"twitter",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,P,S,o,s,w,y]),j=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"twitter"===n&&o&&L(o))}catch(e){return Promise.reject(e)}},[L]),E=i(function(){window.removeEventListener("storage",E,!1);var e=localStorage.getItem("twitter");e&&(j({provider:"twitter",type:"code",code:e}),localStorage.removeItem("twitter"))},[j]),I=i(function(){try{k&&k(),window.addEventListener("storage",E,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;return window.open("https://twitter.com/i/oauth2/authorize?response_type=code&client_id="+o+"&redirect_uri="+s+"&scope="+f+"&state="+m+"&code_challenge=challenge&code_challenge_method=plain","twitter","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e),Promise.resolve()}catch(e){return Promise.reject(e)}},[f,m,o,k,s,E]);return e.createElement("div",{className:a,onClick:I},d)});"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var k=window,b=t(function(t){var c=t.client_id,a=t.scope,s=void 0===a?"name email":a,d=t.className,l=void 0===d?"":d,u=t.onLoginStart,p=t.onReject,h=t.onResolve,m=t.redirect_uri,v=void 0===m?"/":m,f=t.children,g=o(null),w=n(!1),_=w[0],y=w[1];r(function(){!_&&L()},[_]),r(function(){return function(){g.current&&g.current.remove()}},[]);var b=i(function(){return!!document.getElementById("apple-login")},[]),S=i(function(e,t,o,n,r){void 0===t&&(t="script");var i=e.createElement(t);i.id=o,i.src=n,i.async=!0,i.defer=!0;var c=document.getElementsByTagName("script")[0];g.current=i,c&&c.parentNode&&c.parentNode.insertBefore(i,c),i.onload=r},[]),P=i(function(e){h({provider:"apple",data:e})},[h]),L=i(function(){b()?y(!0):S(document,"script","apple-login","https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",function(){k.AppleID.auth.init({clientId:c,scope:s,redirectURI:v,state:"origin:web",usePopup:!0}),y(!0)})},[s,c,v,S,b]),j=i(function(){try{if(!_)return Promise.resolve();var e=function(){if(k.AppleID){u&&u();var e=function(e,t){try{var o=Promise.resolve(k.AppleID.auth.signIn()).then(function(e){P(e)})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){p({err:e})});if(e&&e.then)return e.then(function(){})}else L(),p("Apple SDK isn't loaded!")}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[P,_,L,u,p]);return e.createElement("div",{className:l,onClick:j},f)}),S=t(function(t){var o=t.state,n=void 0===o?"":o,c=t.scope,a=void 0===c?"user.info.basic":c,s=t.client_key,d=t.className,l=void 0===d?"":d,u=t.redirect_uri,p=t.children,h=t.onResolve,m=t.onLoginStart;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_tiktok")&&t&&(localStorage.setItem("tiktok",t),window.close())},[]);var v=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"tiktok"===n&&o&&h({provider:"tiktok",data:{code:o}}))}catch(e){return Promise.reject(e)}},[h]),f=i(function(){window.removeEventListener("storage",f,!1);var e=localStorage.getItem("tiktok");e&&(v({provider:"tiktok",type:"code",code:e}),localStorage.removeItem("instagram"))},[v]),g=i(function(){m&&m(),window.addEventListener("storage",f,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.tiktok.com/auth/authorize?client_key="+s+"&scope="+a+"&state="+n+"_tiktok&redirect_uri="+u+"&response_type=code","Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[a,n,s,u,m,f]);return e.createElement("div",{className:l,onClick:g},p)});export{d as LoginSocialAmazon,b as LoginSocialApple,u as LoginSocialFacebook,v as LoginSocialGithub,m as LoginSocialGoogle,f as LoginSocialInstagram,w as LoginSocialLinkedin,g as LoginSocialMicrosoft,_ as LoginSocialPinterest,S as LoginSocialTiktok,y as LoginSocialTwitter}; +import e,{memo as t,useRef as o,useState as n,useEffect as r,useCallback as i}from"react";function c(){return(c=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var o=0,n=new Array(t);o=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(o=e[Symbol.iterator]()).next.bind(o)}(new URLSearchParams(e));!(t=n()).done;){var r=t.value;o[r[0]]=r[1]}o.access_token?_?P({provider:"github",data:o}):j(o):S("no data")}).catch(function(e){S(e)})}},[n,S,j,P,l,v,u,k,_]),I=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"github"===n&&o&&E(o))}catch(e){return Promise.reject(e)}},[E]),T=i(function(){window.removeEventListener("storage",T,!1);var e=localStorage.getItem("github");e&&(I({provider:"github",type:"code",code:e}),localStorage.removeItem("github"))},[I]),R=i(function(){L&&L(),window.addEventListener("storage",T,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://github.com/login/oauth/authorize?client_id="+l+"&scope="+d+"&state="+n+"_github&redirect_uri="+v+"&allow_signup="+g,"Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[d,n,l,v,g,L,T]);return e.createElement("div",{className:m,onClick:R},b)}),f=t(function(t){var o=t.state,n=void 0===o?"":o,a=t.client_id,s=t.client_secret,d=t.className,l=t.redirect_uri,u=t.fields,h=void 0===u?"id,username,account_type,media_count":u,m=t.scope,v=void 0===m?"user_profile,user_media":m,f=t.response_type,g=void 0===f?"code":f,w=t.isOnlyGetCode,_=void 0!==w&&w,y=t.isOnlyGetToken,k=void 0!==y&&y,b=t.children,S=t.onReject,P=t.onResolve,L=t.onLoginStart;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_instagram")&&t&&(localStorage.setItem("instagram",t),window.close())},[]);var j=i(function(e){fetch("https://cors.bridged.cc/https://graph.instagram.com//me?fields="+h+"&access_token="+e.access_token,{method:"GET",headers:{"x-cors-grida-api-key":p}}).then(function(e){return e.json()}).then(function(t){P({provider:"instagram",data:c({},t,e)})}).catch(function(e){S(e)})},[h,S,P]),E=i(function(e){if(_)P({provider:"instagram",data:{code:e}});else{var t={grant_type:"authorization_code",code:e,redirect_uri:l,client_id:a,client_secret:s},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":p});fetch("https://cors.bridged.cc/https://api.instagram.com/oauth/access_token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?k?P({provider:"instagram",data:e}):j(e):S("no data")}).catch(function(e){S(e)}).finally(function(){})}},[S,P,j,a,l,s,_,k]),I=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"instagram"===n&&o&&E(o))}catch(e){return Promise.reject(e)}},[E]),T=i(function(){window.removeEventListener("storage",T,!1);var e=localStorage.getItem("instagram");e&&(I({provider:"instagram",type:"code",code:e}),localStorage.removeItem("instagram"))},[I]),R=i(function(){L&&L(),window.addEventListener("storage",T,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://api.instagram.com/oauth/authorize?response_type="+g+"&client_id="+a+"&scope="+v+"&state="+n+"_instagram&redirect_uri="+l,"Instagram","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[v,n,a,l,L,g,T]);return e.createElement("div",{className:d,onClick:R},b)}),g=t(function(t){var o=t.tenant,n=void 0===o?"common":o,a=t.state,s=void 0===a?"":a,d=t.client_id,l=t.className,u=t.redirect_uri,p=t.scope,h=void 0===p?"profile openid email":p,m=t.response_type,v=void 0===m?"code":m,f=t.response_mode,g=void 0===f?"query":f,w=t.children,_=t.code_challenge,y=void 0===_?"19cfc47c216dacba8ca23eeee817603e2ba34fe0976378662ba31688ed302fa9":_,k=t.code_challenge_method,b=void 0===k?"plain":k,S=t.prompt,P=void 0===S?"select_account":S,L=t.isOnlyGetCode,j=void 0!==L&&L,E=t.isOnlyGetToken,I=void 0!==E&&E,T=t.onLoginStart,R=t.onReject,N=t.onResolve;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_microsoft")&&t&&(localStorage.setItem("microsoft",t),window.close())},[]);var z=i(function(e){fetch("https://graph.microsoft.com/v1.0/me",{method:"GET",headers:{Authorization:"Bearer "+e.access_token}}).then(function(e){return e.json()}).then(function(t){N({provider:"microsoft",data:c({},t,e)})}).catch(function(e){R(e)})},[R,N]),C=i(function(e){if(j)N({provider:"microsoft",data:{code:e}});else{var t={code:e,scope:h,client_id:d,redirect_uri:u,code_verifier:y,grant_type:"authorization_code"},o=new Headers({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"});fetch("https://login.microsoftonline.com/"+n+"/oauth2/v2.0/token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?I?N({provider:"microsoft",data:e}):z(e):R("no data")}).catch(function(e){R(e)})}},[h,n,R,z,d,N,u,y,j,I]),G=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"microsoft"===n&&o&&C(o))}catch(e){return Promise.reject(e)}},[C]),O=i(function(){window.removeEventListener("storage",O,!1);var e=localStorage.getItem("microsoft");e&&(G({provider:"microsoft",type:"code",code:e}),localStorage.removeItem("microsoft"))},[G]),x=i(function(){T&&T(),window.addEventListener("storage",O,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://login.microsoftonline.com/"+n+"/oauth2/v2.0/authorize?client_id="+d+"\n &response_type="+v+"\n &redirect_uri="+u+"\n &response_mode="+g+"\n &scope="+h+"\n &state="+s+"_microsoft\n &prompt="+P+"\n &code_challenge="+y+"\n &code_challenge_method="+b,"Microsoft","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[h,s,P,n,d,T,u,g,v,y,O,b]);return e.createElement("div",{className:l,onClick:x},w)}),w=t(function(t){var o=t.state,n=void 0===o?"":o,a=t.scope,s=void 0===a?"r_liteprofile":a,d=t.client_id,l=t.client_secret,u=t.className,h=void 0===u?"":u,m=t.redirect_uri,v=t.response_type,f=void 0===v?"code":v,g=t.isOnlyGetCode,w=void 0!==g&&g,_=t.isOnlyGetToken,y=void 0!==_&&_,k=t.children,b=t.onLoginStart,S=t.onReject,P=t.onResolve;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_linkedin")&&t&&(localStorage.setItem("linkedin",t),window.close())},[]);var L=i(function(e){fetch("https://api.allorigins.win/get?url="+encodeURIComponent("https://api.linkedin.com/v2/me?oauth2_access_token="+e.access_token+"&projection=(id,profilePicture(displayImage~digitalmediaAsset:playableStreams),localizedLastName, firstName,lastName,localizedFirstName)"),{method:"GET"}).then(function(e){return e.json()}).then(function(t){var o=c({},e);if(t.contents){var n=JSON.parse(t.contents);"object"==typeof e&&Object.entries(n).map(function(e){o[e[0]]=e[1]})}P({provider:"linkedin",data:o})}).catch(function(e){S(e)})},[S,P]),j=i(function(e){if(w)P({provider:"linkedin",data:{code:e}});else{var t={code:e,grant_type:"authorization_code",redirect_uri:m,client_id:d,client_secret:l},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":p});fetch("https://cors.bridged.cc/https://www.linkedin.com/oauth/v2/accessToken",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){y?P({provider:"linkedin",data:e}):L(e)}).catch(function(e){S(e)})}},[S,P,d,L,m,l,w,y]),E=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"linkedin"===n&&o&&j(o))}catch(e){return Promise.reject(e)}},[j]),I=i(function(){window.removeEventListener("storage",I,!1);var e=localStorage.getItem("linkedin");e&&(E({provider:"linkedin",type:"code",code:e}),localStorage.removeItem("linkedin"))},[E]),T=i(function(){b&&b(),window.addEventListener("storage",I,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.linkedin.com/oauth/v2/authorization?response_type="+f+"&client_id="+d+"&scope="+s+"&state="+n+"_linkedin&redirect_uri="+m,"Linkedin","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[b,I,f,d,s,n,m]);return e.createElement("div",{className:h,onClick:T},k)}),_=t(function(t){var o=t.state,n=void 0===o?"":o,a=t.scope,s=void 0===a?"boards:read,pins:read,user_accounts:read":a,d=t.client_id,l=t.client_secret,u=t.className,h=void 0===u?"":u,m=t.redirect_uri,v=t.isOnlyGetCode,f=void 0!==v&&v,g=t.isOnlyGetToken,w=void 0!==g&&g,_=t.children,y=t.onLoginStart,k=t.onReject,b=t.onResolve;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_pinterest")&&t&&(localStorage.setItem("pinterest",t),window.close())},[]);var S=i(function(e){fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/user_account",{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":p}}).then(function(e){return e.json()}).then(function(t){b({provider:"pinterest",data:c({},e,t)})}).catch(function(e){return k(e)})},[k,b]),P=i(function(e){try{var t=function(){if(!f){var t={code:e,redirect_uri:m,grant_type:"authorization_code"},o=[];for(var n in t){var r=encodeURIComponent(n),i=encodeURIComponent(t[n]);o.push(r+"="+i)}return o=o.join("&"),Promise.resolve(fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/oauth/token",{method:"POST",headers:{Authorization:"Basic "+btoa(d+":"+l),"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":p},body:o}).then(function(e){return e.json()}).catch(function(e){return k(e)})).then(function(e){e.access_token&&(w?b({provider:"pinterest",data:e}):S(e))})}b({provider:"pinterest",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[k,d,S,b,m,l,f,w]),L=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"pinterest"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=i(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("pinterest");e&&(L({provider:"pinterest",type:"code",code:e}),localStorage.removeItem("pinterest"))},[L]),E=i(function(){y&&y(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.pinterest.com/oauth/?client_id="+d+"&scope="+s+"&state="+n+"_pinterest&redirect_uri="+m+"&response_type=code","Pinterest","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[s,n,d,m,y,j]);return e.createElement("div",{className:h,onClick:E},_)}),y=t(function(t){var o=t.client_id,n=t.className,a=void 0===n?"":n,s=t.redirect_uri,d=t.children,l=t.fields,u=void 0===l?"created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld":l,h=t.state,m=void 0===h?"state":h,v=t.scope,f=void 0===v?"users.read%20tweet.read":v,g=t.isOnlyGetCode,w=void 0!==g&&g,_=t.isOnlyGetToken,y=void 0!==_&&_,k=t.onLoginStart,b=t.onReject,S=t.onResolve;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code");e.searchParams.get("state")&&t&&(localStorage.setItem("twitter",""+t),window.close())},[]);var P=i(function(e){fetch("https://cors.bridged.cc/https://api.twitter.com/2/users/me?user.fields="+u,{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":p}}).then(function(e){return e.json()}).then(function(t){S({provider:"twitter",data:c({},e,t.data)})}).catch(function(e){return b(e)})},[u,b,S]),L=i(function(e){try{var t=function(){if(!w){var t=new URLSearchParams({code:e,redirect_uri:s,client_id:o,grant_type:"authorization_code",code_verifier:"challenge"});return Promise.resolve(fetch("https://cors.bridged.cc/https://api.twitter.com/2/oauth2/token",{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":p}}).then(function(e){return e.json()}).catch(function(e){return b(e)})).then(function(e){e.access_token&&(y?S({provider:"twitter",data:e}):P(e))})}S({provider:"twitter",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,P,S,o,s,w,y]),j=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"twitter"===n&&o&&L(o))}catch(e){return Promise.reject(e)}},[L]),E=i(function(){window.removeEventListener("storage",E,!1);var e=localStorage.getItem("twitter");e&&(j({provider:"twitter",type:"code",code:e}),localStorage.removeItem("twitter"))},[j]),I=i(function(){try{k&&k(),window.addEventListener("storage",E,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;return window.open("https://twitter.com/i/oauth2/authorize?response_type=code&client_id="+o+"&redirect_uri="+s+"&scope="+f+"&state="+m+"&code_challenge=challenge&code_challenge_method=plain","twitter","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e),Promise.resolve()}catch(e){return Promise.reject(e)}},[f,m,o,k,s,E]);return e.createElement("div",{className:a,onClick:I},d)});"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var k=window,b=t(function(t){var c=t.client_id,a=t.scope,s=void 0===a?"name email":a,d=t.className,l=void 0===d?"":d,u=t.onLoginStart,p=t.onReject,h=t.onResolve,m=t.redirect_uri,v=void 0===m?"/":m,f=t.children,g=o(null),w=n(!1),_=w[0],y=w[1];r(function(){!_&&L()},[_]),r(function(){return function(){g.current&&g.current.remove()}},[]);var b=i(function(){return!!document.getElementById("apple-login")},[]),S=i(function(e,t,o,n,r){void 0===t&&(t="script");var i=e.createElement(t);i.id=o,i.src=n,i.async=!0,i.defer=!0;var c=document.getElementsByTagName("script")[0];g.current=i,c&&c.parentNode&&c.parentNode.insertBefore(i,c),i.onload=r},[]),P=i(function(e){h({provider:"apple",data:e})},[h]),L=i(function(){b()?y(!0):S(document,"script","apple-login","https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",function(){k.AppleID.auth.init({clientId:c,scope:s,redirectURI:v,state:"origin:web",usePopup:!0}),y(!0)})},[s,c,v,S,b]),j=i(function(){try{if(!_)return Promise.resolve();var e=function(){if(k.AppleID){u&&u();var e=function(e,t){try{var o=Promise.resolve(k.AppleID.auth.signIn()).then(function(e){P(e)})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){p({err:e})});if(e&&e.then)return e.then(function(){})}else L(),p("Apple SDK isn't loaded!")}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[P,_,L,u,p]);return e.createElement("div",{className:l,onClick:j},f)}),S=t(function(t){var o=t.state,n=void 0===o?"":o,c=t.scope,a=void 0===c?"user.info.basic":c,s=t.client_key,d=t.className,l=void 0===d?"":d,u=t.redirect_uri,p=t.children,h=t.onResolve,m=t.onLoginStart;r(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_tiktok")&&t&&(localStorage.setItem("tiktok",t),window.close())},[]);var v=i(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"tiktok"===n&&o&&h({provider:"tiktok",data:{code:o}}))}catch(e){return Promise.reject(e)}},[h]),f=i(function(){window.removeEventListener("storage",f,!1);var e=localStorage.getItem("tiktok");e&&(v({provider:"tiktok",type:"code",code:e}),localStorage.removeItem("instagram"))},[v]),g=i(function(){m&&m(),window.addEventListener("storage",f,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.tiktok.com/v2/auth/authorize/?client_key="+s+"&scope="+a+"&state="+n+"_tiktok&redirect_uri="+u+"&response_type=code","Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[a,n,s,u,m,f]);return e.createElement("div",{className:l,onClick:g},p)});export{d as LoginSocialAmazon,b as LoginSocialApple,u as LoginSocialFacebook,v as LoginSocialGithub,m as LoginSocialGoogle,f as LoginSocialInstagram,w as LoginSocialLinkedin,g as LoginSocialMicrosoft,_ as LoginSocialPinterest,S as LoginSocialTiktok,y as LoginSocialTwitter}; diff --git a/node_modules/reactjs-social-login/dist/reactjs-social-login.umd.js b/node_modules/reactjs-social-login/dist/reactjs-social-login.umd.js index 4a20432..55e30f0 100644 --- a/node_modules/reactjs-social-login/dist/reactjs-social-login.umd.js +++ b/node_modules/reactjs-social-login/dist/reactjs-social-login.umd.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).reactjsSocialLogin={},e.react)}(this,function(e,t){var o="default"in t?t.default:t;function n(){return(n=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var o=0,n=new Array(t);o=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(o=e[Symbol.iterator]()).next.bind(o)}(new URLSearchParams(e));!(t=n()).done;){var i=t.value;o[i[0]]=i[1]}o.access_token?w?C({provider:"github",data:o}):E(o):y("no data")}).catch(function(e){y(e)})}},[a,y,E,C,l,m,u,k,w]),L=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"github"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=t.useCallback(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("github");e&&(L({provider:"github",type:"code",code:e}),localStorage.removeItem("github"))},[L]),I=t.useCallback(function(){S&&S(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://github.com/login/oauth/authorize?client_id="+l+"&scope="+s+"&state="+a+"_github&redirect_uri="+m+"&allow_signup="+v,"Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[s,a,l,m,v,S,j]);return o.createElement("div",{className:f,onClick:I},b)}),f=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.client_id,c=e.client_secret,s=e.className,l=e.redirect_uri,u=e.fields,p=void 0===u?"id,username,account_type,media_count":u,f=e.scope,m=void 0===f?"user_profile,user_media":f,h=e.response_type,v=void 0===h?"code":h,g=e.isOnlyGetCode,w=void 0!==g&&g,_=e.isOnlyGetToken,k=void 0!==_&&_,b=e.children,y=e.onReject,C=e.onResolve,S=e.onLoginStart;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_instagram")&&t&&(localStorage.setItem("instagram",t),window.close())},[]);var E=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://graph.instagram.com//me?fields="+p+"&access_token="+e.access_token,{method:"GET",headers:{"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){C({provider:"instagram",data:n({},t,e)})}).catch(function(e){y(e)})},[p,y,C]),P=t.useCallback(function(e){if(w)C({provider:"instagram",data:{code:e}});else{var t={grant_type:"authorization_code",code:e,redirect_uri:l,client_id:a,client_secret:c},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d});fetch("https://cors.bridged.cc/https://api.instagram.com/oauth/access_token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?k?C({provider:"instagram",data:e}):E(e):y("no data")}).catch(function(e){y(e)}).finally(function(){})}},[y,C,E,a,l,c,w,k]),L=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"instagram"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=t.useCallback(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("instagram");e&&(L({provider:"instagram",type:"code",code:e}),localStorage.removeItem("instagram"))},[L]),I=t.useCallback(function(){S&&S(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://api.instagram.com/oauth/authorize?response_type="+v+"&client_id="+a+"&scope="+m+"&state="+i+"_instagram&redirect_uri="+l,"Instagram","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[m,i,a,l,S,v,j]);return o.createElement("div",{className:s,onClick:I},b)}),m=t.memo(function(e){var r=e.tenant,i=void 0===r?"common":r,a=e.state,c=void 0===a?"":a,s=e.client_id,d=e.className,l=e.redirect_uri,u=e.scope,p=void 0===u?"profile openid email":u,f=e.response_type,m=void 0===f?"code":f,h=e.response_mode,v=void 0===h?"query":h,g=e.children,w=e.code_challenge,_=void 0===w?"19cfc47c216dacba8ca23eeee817603e2ba34fe0976378662ba31688ed302fa9":w,k=e.code_challenge_method,b=void 0===k?"plain":k,y=e.prompt,C=void 0===y?"select_account":y,S=e.isOnlyGetCode,E=void 0!==S&&S,P=e.isOnlyGetToken,L=void 0!==P&&P,j=e.onLoginStart,I=e.onReject,R=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_microsoft")&&t&&(localStorage.setItem("microsoft",t),window.close())},[]);var T=t.useCallback(function(e){fetch("https://graph.microsoft.com/v1.0/me",{method:"GET",headers:{Authorization:"Bearer "+e.access_token}}).then(function(e){return e.json()}).then(function(t){R({provider:"microsoft",data:n({},t,e)})}).catch(function(e){I(e)})},[I,R]),N=t.useCallback(function(e){if(E)R({provider:"microsoft",data:{code:e}});else{var t={code:e,scope:p,client_id:s,redirect_uri:l,code_verifier:_,grant_type:"authorization_code"},o=new Headers({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"});fetch("https://login.microsoftonline.com/"+i+"/oauth2/v2.0/token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?L?R({provider:"microsoft",data:e}):T(e):I("no data")}).catch(function(e){I(e)})}},[p,i,I,T,s,R,l,_,E,L]),z=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"microsoft"===n&&o&&N(o))}catch(e){return Promise.reject(e)}},[N]),G=t.useCallback(function(){window.removeEventListener("storage",G,!1);var e=localStorage.getItem("microsoft");e&&(z({provider:"microsoft",type:"code",code:e}),localStorage.removeItem("microsoft"))},[z]),x=t.useCallback(function(){j&&j(),window.addEventListener("storage",G,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://login.microsoftonline.com/"+i+"/oauth2/v2.0/authorize?client_id="+s+"\n &response_type="+m+"\n &redirect_uri="+l+"\n &response_mode="+v+"\n &scope="+p+"\n &state="+c+"_microsoft\n &prompt="+C+"\n &code_challenge="+_+"\n &code_challenge_method="+b,"Microsoft","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[p,c,C,i,s,j,l,v,m,_,G,b]);return o.createElement("div",{className:d,onClick:x},g)}),h=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.scope,c=void 0===a?"r_liteprofile":a,s=e.client_id,l=e.client_secret,u=e.className,p=void 0===u?"":u,f=e.redirect_uri,m=e.response_type,h=void 0===m?"code":m,v=e.isOnlyGetCode,g=void 0!==v&&v,w=e.isOnlyGetToken,_=void 0!==w&&w,k=e.children,b=e.onLoginStart,y=e.onReject,C=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_linkedin")&&t&&(localStorage.setItem("linkedin",t),window.close())},[]);var S=t.useCallback(function(e){fetch("https://api.allorigins.win/get?url="+encodeURIComponent("https://api.linkedin.com/v2/me?oauth2_access_token="+e.access_token+"&projection=(id,profilePicture(displayImage~digitalmediaAsset:playableStreams),localizedLastName, firstName,lastName,localizedFirstName)"),{method:"GET"}).then(function(e){return e.json()}).then(function(t){var o=n({},e);if(t.contents){var r=JSON.parse(t.contents);"object"==typeof e&&Object.entries(r).map(function(e){o[e[0]]=e[1]})}C({provider:"linkedin",data:o})}).catch(function(e){y(e)})},[y,C]),E=t.useCallback(function(e){if(g)C({provider:"linkedin",data:{code:e}});else{var t={code:e,grant_type:"authorization_code",redirect_uri:f,client_id:s,client_secret:l},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d});fetch("https://cors.bridged.cc/https://www.linkedin.com/oauth/v2/accessToken",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){_?C({provider:"linkedin",data:e}):S(e)}).catch(function(e){y(e)})}},[y,C,s,S,f,l,g,_]),P=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"linkedin"===n&&o&&E(o))}catch(e){return Promise.reject(e)}},[E]),L=t.useCallback(function(){window.removeEventListener("storage",L,!1);var e=localStorage.getItem("linkedin");e&&(P({provider:"linkedin",type:"code",code:e}),localStorage.removeItem("linkedin"))},[P]),j=t.useCallback(function(){b&&b(),window.addEventListener("storage",L,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.linkedin.com/oauth/v2/authorization?response_type="+h+"&client_id="+s+"&scope="+c+"&state="+i+"_linkedin&redirect_uri="+f,"Linkedin","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[b,L,h,s,c,i,f]);return o.createElement("div",{className:p,onClick:j},k)}),v=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.scope,c=void 0===a?"boards:read,pins:read,user_accounts:read":a,s=e.client_id,l=e.client_secret,u=e.className,p=void 0===u?"":u,f=e.redirect_uri,m=e.isOnlyGetCode,h=void 0!==m&&m,v=e.isOnlyGetToken,g=void 0!==v&&v,w=e.children,_=e.onLoginStart,k=e.onReject,b=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_pinterest")&&t&&(localStorage.setItem("pinterest",t),window.close())},[]);var y=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/user_account",{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){b({provider:"pinterest",data:n({},e,t)})}).catch(function(e){return k(e)})},[k,b]),C=t.useCallback(function(e){try{var t=function(){if(!h){var t={code:e,redirect_uri:f,grant_type:"authorization_code"},o=[];for(var n in t){var r=encodeURIComponent(n),i=encodeURIComponent(t[n]);o.push(r+"="+i)}return o=o.join("&"),Promise.resolve(fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/oauth/token",{method:"POST",headers:{Authorization:"Basic "+btoa(s+":"+l),"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d},body:o}).then(function(e){return e.json()}).catch(function(e){return k(e)})).then(function(e){e.access_token&&(g?b({provider:"pinterest",data:e}):y(e))})}b({provider:"pinterest",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[k,s,y,b,f,l,h,g]),S=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"pinterest"===n&&o&&C(o))}catch(e){return Promise.reject(e)}},[C]),E=t.useCallback(function(){window.removeEventListener("storage",E,!1);var e=localStorage.getItem("pinterest");e&&(S({provider:"pinterest",type:"code",code:e}),localStorage.removeItem("pinterest"))},[S]),P=t.useCallback(function(){_&&_(),window.addEventListener("storage",E,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.pinterest.com/oauth/?client_id="+s+"&scope="+c+"&state="+i+"_pinterest&redirect_uri="+f+"&response_type=code","Pinterest","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[c,i,s,f,_,E]);return o.createElement("div",{className:p,onClick:P},w)}),g=t.memo(function(e){var r=e.client_id,i=e.className,a=void 0===i?"":i,c=e.redirect_uri,s=e.children,l=e.fields,u=void 0===l?"created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld":l,p=e.state,f=void 0===p?"state":p,m=e.scope,h=void 0===m?"users.read%20tweet.read":m,v=e.isOnlyGetCode,g=void 0!==v&&v,w=e.isOnlyGetToken,_=void 0!==w&&w,k=e.onLoginStart,b=e.onReject,y=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code");e.searchParams.get("state")&&t&&(localStorage.setItem("twitter",""+t),window.close())},[]);var C=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://api.twitter.com/2/users/me?user.fields="+u,{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){y({provider:"twitter",data:n({},e,t.data)})}).catch(function(e){return b(e)})},[u,b,y]),S=t.useCallback(function(e){try{var t=function(){if(!g){var t=new URLSearchParams({code:e,redirect_uri:c,client_id:r,grant_type:"authorization_code",code_verifier:"challenge"});return Promise.resolve(fetch("https://cors.bridged.cc/https://api.twitter.com/2/oauth2/token",{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d}}).then(function(e){return e.json()}).catch(function(e){return b(e)})).then(function(e){e.access_token&&(_?y({provider:"twitter",data:e}):C(e))})}y({provider:"twitter",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,C,y,r,c,g,_]),E=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"twitter"===n&&o&&S(o))}catch(e){return Promise.reject(e)}},[S]),P=t.useCallback(function(){window.removeEventListener("storage",P,!1);var e=localStorage.getItem("twitter");e&&(E({provider:"twitter",type:"code",code:e}),localStorage.removeItem("twitter"))},[E]),L=t.useCallback(function(){try{k&&k(),window.addEventListener("storage",P,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;return window.open("https://twitter.com/i/oauth2/authorize?response_type=code&client_id="+r+"&redirect_uri="+c+"&scope="+h+"&state="+f+"&code_challenge=challenge&code_challenge_method=plain","twitter","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e),Promise.resolve()}catch(e){return Promise.reject(e)}},[h,f,r,k,c,P]);return o.createElement("div",{className:a,onClick:L},s)});"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var w=window,_=t.memo(function(e){var n=e.client_id,r=e.scope,i=void 0===r?"name email":r,a=e.className,c=void 0===a?"":a,s=e.onLoginStart,d=e.onReject,l=e.onResolve,u=e.redirect_uri,p=void 0===u?"/":u,f=e.children,m=t.useRef(null),h=t.useState(!1),v=h[0],g=h[1];t.useEffect(function(){!v&&y()},[v]),t.useEffect(function(){return function(){m.current&&m.current.remove()}},[]);var _=t.useCallback(function(){return!!document.getElementById("apple-login")},[]),k=t.useCallback(function(e,t,o,n,r){void 0===t&&(t="script");var i=e.createElement(t);i.id=o,i.src=n,i.async=!0,i.defer=!0;var a=document.getElementsByTagName("script")[0];m.current=i,a&&a.parentNode&&a.parentNode.insertBefore(i,a),i.onload=r},[]),b=t.useCallback(function(e){l({provider:"apple",data:e})},[l]),y=t.useCallback(function(){_()?g(!0):k(document,"script","apple-login","https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",function(){w.AppleID.auth.init({clientId:n,scope:i,redirectURI:p,state:"origin:web",usePopup:!0}),g(!0)})},[i,n,p,k,_]),C=t.useCallback(function(){try{if(!v)return Promise.resolve();var e=function(){if(w.AppleID){s&&s();var e=function(e,t){try{var o=Promise.resolve(w.AppleID.auth.signIn()).then(function(e){b(e)})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){d({err:e})});if(e&&e.then)return e.then(function(){})}else y(),d("Apple SDK isn't loaded!")}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,v,y,s,d]);return o.createElement("div",{className:c,onClick:C},f)}),k=t.memo(function(e){var n=e.state,r=void 0===n?"":n,i=e.scope,a=void 0===i?"user.info.basic":i,c=e.client_key,s=e.className,d=void 0===s?"":s,l=e.redirect_uri,u=e.children,p=e.onResolve,f=e.onLoginStart;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_tiktok")&&t&&(localStorage.setItem("tiktok",t),window.close())},[]);var m=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"tiktok"===n&&o&&p({provider:"tiktok",data:{code:o}}))}catch(e){return Promise.reject(e)}},[p]),h=t.useCallback(function(){window.removeEventListener("storage",h,!1);var e=localStorage.getItem("tiktok");e&&(m({provider:"tiktok",type:"code",code:e}),localStorage.removeItem("instagram"))},[m]),v=t.useCallback(function(){f&&f(),window.addEventListener("storage",h,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.tiktok.com/auth/authorize?client_key="+c+"&scope="+a+"&state="+r+"_tiktok&redirect_uri="+l+"&response_type=code","Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[a,r,c,l,f,h]);return o.createElement("div",{className:d,onClick:v},u)});e.LoginSocialAmazon=a,e.LoginSocialApple=_,e.LoginSocialFacebook=s,e.LoginSocialGithub=p,e.LoginSocialGoogle=u,e.LoginSocialInstagram=f,e.LoginSocialLinkedin=h,e.LoginSocialMicrosoft=m,e.LoginSocialPinterest=v,e.LoginSocialTiktok=k,e.LoginSocialTwitter=g}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).reactjsSocialLogin={},e.react)}(this,function(e,t){var o="default"in t?t.default:t;function n(){return(n=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var o=0,n=new Array(t);o=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(o=e[Symbol.iterator]()).next.bind(o)}(new URLSearchParams(e));!(t=n()).done;){var i=t.value;o[i[0]]=i[1]}o.access_token?w?C({provider:"github",data:o}):E(o):y("no data")}).catch(function(e){y(e)})}},[a,y,E,C,l,m,u,k,w]),L=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"github"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=t.useCallback(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("github");e&&(L({provider:"github",type:"code",code:e}),localStorage.removeItem("github"))},[L]),I=t.useCallback(function(){S&&S(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://github.com/login/oauth/authorize?client_id="+l+"&scope="+s+"&state="+a+"_github&redirect_uri="+m+"&allow_signup="+v,"Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[s,a,l,m,v,S,j]);return o.createElement("div",{className:f,onClick:I},b)}),f=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.client_id,c=e.client_secret,s=e.className,l=e.redirect_uri,u=e.fields,p=void 0===u?"id,username,account_type,media_count":u,f=e.scope,m=void 0===f?"user_profile,user_media":f,h=e.response_type,v=void 0===h?"code":h,g=e.isOnlyGetCode,w=void 0!==g&&g,_=e.isOnlyGetToken,k=void 0!==_&&_,b=e.children,y=e.onReject,C=e.onResolve,S=e.onLoginStart;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_instagram")&&t&&(localStorage.setItem("instagram",t),window.close())},[]);var E=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://graph.instagram.com//me?fields="+p+"&access_token="+e.access_token,{method:"GET",headers:{"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){C({provider:"instagram",data:n({},t,e)})}).catch(function(e){y(e)})},[p,y,C]),P=t.useCallback(function(e){if(w)C({provider:"instagram",data:{code:e}});else{var t={grant_type:"authorization_code",code:e,redirect_uri:l,client_id:a,client_secret:c},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d});fetch("https://cors.bridged.cc/https://api.instagram.com/oauth/access_token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?k?C({provider:"instagram",data:e}):E(e):y("no data")}).catch(function(e){y(e)}).finally(function(){})}},[y,C,E,a,l,c,w,k]),L=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"instagram"===n&&o&&P(o))}catch(e){return Promise.reject(e)}},[P]),j=t.useCallback(function(){window.removeEventListener("storage",j,!1);var e=localStorage.getItem("instagram");e&&(L({provider:"instagram",type:"code",code:e}),localStorage.removeItem("instagram"))},[L]),I=t.useCallback(function(){S&&S(),window.addEventListener("storage",j,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://api.instagram.com/oauth/authorize?response_type="+v+"&client_id="+a+"&scope="+m+"&state="+i+"_instagram&redirect_uri="+l,"Instagram","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[m,i,a,l,S,v,j]);return o.createElement("div",{className:s,onClick:I},b)}),m=t.memo(function(e){var r=e.tenant,i=void 0===r?"common":r,a=e.state,c=void 0===a?"":a,s=e.client_id,d=e.className,l=e.redirect_uri,u=e.scope,p=void 0===u?"profile openid email":u,f=e.response_type,m=void 0===f?"code":f,h=e.response_mode,v=void 0===h?"query":h,g=e.children,w=e.code_challenge,_=void 0===w?"19cfc47c216dacba8ca23eeee817603e2ba34fe0976378662ba31688ed302fa9":w,k=e.code_challenge_method,b=void 0===k?"plain":k,y=e.prompt,C=void 0===y?"select_account":y,S=e.isOnlyGetCode,E=void 0!==S&&S,P=e.isOnlyGetToken,L=void 0!==P&&P,j=e.onLoginStart,I=e.onReject,R=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_microsoft")&&t&&(localStorage.setItem("microsoft",t),window.close())},[]);var T=t.useCallback(function(e){fetch("https://graph.microsoft.com/v1.0/me",{method:"GET",headers:{Authorization:"Bearer "+e.access_token}}).then(function(e){return e.json()}).then(function(t){R({provider:"microsoft",data:n({},t,e)})}).catch(function(e){I(e)})},[I,R]),N=t.useCallback(function(e){if(E)R({provider:"microsoft",data:{code:e}});else{var t={code:e,scope:p,client_id:s,redirect_uri:l,code_verifier:_,grant_type:"authorization_code"},o=new Headers({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"});fetch("https://login.microsoftonline.com/"+i+"/oauth2/v2.0/token",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){e.access_token?L?R({provider:"microsoft",data:e}):T(e):I("no data")}).catch(function(e){I(e)})}},[p,i,I,T,s,R,l,_,E,L]),z=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"microsoft"===n&&o&&N(o))}catch(e){return Promise.reject(e)}},[N]),G=t.useCallback(function(){window.removeEventListener("storage",G,!1);var e=localStorage.getItem("microsoft");e&&(z({provider:"microsoft",type:"code",code:e}),localStorage.removeItem("microsoft"))},[z]),x=t.useCallback(function(){j&&j(),window.addEventListener("storage",G,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://login.microsoftonline.com/"+i+"/oauth2/v2.0/authorize?client_id="+s+"\n &response_type="+m+"\n &redirect_uri="+l+"\n &response_mode="+v+"\n &scope="+p+"\n &state="+c+"_microsoft\n &prompt="+C+"\n &code_challenge="+_+"\n &code_challenge_method="+b,"Microsoft","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[p,c,C,i,s,j,l,v,m,_,G,b]);return o.createElement("div",{className:d,onClick:x},g)}),h=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.scope,c=void 0===a?"r_liteprofile":a,s=e.client_id,l=e.client_secret,u=e.className,p=void 0===u?"":u,f=e.redirect_uri,m=e.response_type,h=void 0===m?"code":m,v=e.isOnlyGetCode,g=void 0!==v&&v,w=e.isOnlyGetToken,_=void 0!==w&&w,k=e.children,b=e.onLoginStart,y=e.onReject,C=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_linkedin")&&t&&(localStorage.setItem("linkedin",t),window.close())},[]);var S=t.useCallback(function(e){fetch("https://api.allorigins.win/get?url="+encodeURIComponent("https://api.linkedin.com/v2/me?oauth2_access_token="+e.access_token+"&projection=(id,profilePicture(displayImage~digitalmediaAsset:playableStreams),localizedLastName, firstName,lastName,localizedFirstName)"),{method:"GET"}).then(function(e){return e.json()}).then(function(t){var o=n({},e);if(t.contents){var r=JSON.parse(t.contents);"object"==typeof e&&Object.entries(r).map(function(e){o[e[0]]=e[1]})}C({provider:"linkedin",data:o})}).catch(function(e){y(e)})},[y,C]),E=t.useCallback(function(e){if(g)C({provider:"linkedin",data:{code:e}});else{var t={code:e,grant_type:"authorization_code",redirect_uri:f,client_id:s,client_secret:l},o=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d});fetch("https://cors.bridged.cc/https://www.linkedin.com/oauth/v2/accessToken",{method:"POST",headers:o,body:new URLSearchParams(t)}).then(function(e){return e.json()}).then(function(e){_?C({provider:"linkedin",data:e}):S(e)}).catch(function(e){y(e)})}},[y,C,s,S,f,l,g,_]),P=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"linkedin"===n&&o&&E(o))}catch(e){return Promise.reject(e)}},[E]),L=t.useCallback(function(){window.removeEventListener("storage",L,!1);var e=localStorage.getItem("linkedin");e&&(P({provider:"linkedin",type:"code",code:e}),localStorage.removeItem("linkedin"))},[P]),j=t.useCallback(function(){b&&b(),window.addEventListener("storage",L,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.linkedin.com/oauth/v2/authorization?response_type="+h+"&client_id="+s+"&scope="+c+"&state="+i+"_linkedin&redirect_uri="+f,"Linkedin","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[b,L,h,s,c,i,f]);return o.createElement("div",{className:p,onClick:j},k)}),v=t.memo(function(e){var r=e.state,i=void 0===r?"":r,a=e.scope,c=void 0===a?"boards:read,pins:read,user_accounts:read":a,s=e.client_id,l=e.client_secret,u=e.className,p=void 0===u?"":u,f=e.redirect_uri,m=e.isOnlyGetCode,h=void 0!==m&&m,v=e.isOnlyGetToken,g=void 0!==v&&v,w=e.children,_=e.onLoginStart,k=e.onReject,b=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_pinterest")&&t&&(localStorage.setItem("pinterest",t),window.close())},[]);var y=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/user_account",{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){b({provider:"pinterest",data:n({},e,t)})}).catch(function(e){return k(e)})},[k,b]),C=t.useCallback(function(e){try{var t=function(){if(!h){var t={code:e,redirect_uri:f,grant_type:"authorization_code"},o=[];for(var n in t){var r=encodeURIComponent(n),i=encodeURIComponent(t[n]);o.push(r+"="+i)}return o=o.join("&"),Promise.resolve(fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/oauth/token",{method:"POST",headers:{Authorization:"Basic "+btoa(s+":"+l),"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d},body:o}).then(function(e){return e.json()}).catch(function(e){return k(e)})).then(function(e){e.access_token&&(g?b({provider:"pinterest",data:e}):y(e))})}b({provider:"pinterest",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[k,s,y,b,f,l,h,g]),S=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"pinterest"===n&&o&&C(o))}catch(e){return Promise.reject(e)}},[C]),E=t.useCallback(function(){window.removeEventListener("storage",E,!1);var e=localStorage.getItem("pinterest");e&&(S({provider:"pinterest",type:"code",code:e}),localStorage.removeItem("pinterest"))},[S]),P=t.useCallback(function(){_&&_(),window.addEventListener("storage",E,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.pinterest.com/oauth/?client_id="+s+"&scope="+c+"&state="+i+"_pinterest&redirect_uri="+f+"&response_type=code","Pinterest","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[c,i,s,f,_,E]);return o.createElement("div",{className:p,onClick:P},w)}),g=t.memo(function(e){var r=e.client_id,i=e.className,a=void 0===i?"":i,c=e.redirect_uri,s=e.children,l=e.fields,u=void 0===l?"created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld":l,p=e.state,f=void 0===p?"state":p,m=e.scope,h=void 0===m?"users.read%20tweet.read":m,v=e.isOnlyGetCode,g=void 0!==v&&v,w=e.isOnlyGetToken,_=void 0!==w&&w,k=e.onLoginStart,b=e.onReject,y=e.onResolve;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code");e.searchParams.get("state")&&t&&(localStorage.setItem("twitter",""+t),window.close())},[]);var C=t.useCallback(function(e){fetch("https://cors.bridged.cc/https://api.twitter.com/2/users/me?user.fields="+u,{method:"GET",headers:{Authorization:"Bearer "+e.access_token,"x-cors-grida-api-key":d}}).then(function(e){return e.json()}).then(function(t){y({provider:"twitter",data:n({},e,t.data)})}).catch(function(e){return b(e)})},[u,b,y]),S=t.useCallback(function(e){try{var t=function(){if(!g){var t=new URLSearchParams({code:e,redirect_uri:c,client_id:r,grant_type:"authorization_code",code_verifier:"challenge"});return Promise.resolve(fetch("https://cors.bridged.cc/https://api.twitter.com/2/oauth2/token",{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":d}}).then(function(e){return e.json()}).catch(function(e){return b(e)})).then(function(e){e.access_token&&(_?y({provider:"twitter",data:e}):C(e))})}y({provider:"twitter",data:{code:e}})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,C,y,r,c,g,_]),E=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"twitter"===n&&o&&S(o))}catch(e){return Promise.reject(e)}},[S]),P=t.useCallback(function(){window.removeEventListener("storage",P,!1);var e=localStorage.getItem("twitter");e&&(E({provider:"twitter",type:"code",code:e}),localStorage.removeItem("twitter"))},[E]),L=t.useCallback(function(){try{k&&k(),window.addEventListener("storage",P,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;return window.open("https://twitter.com/i/oauth2/authorize?response_type=code&client_id="+r+"&redirect_uri="+c+"&scope="+h+"&state="+f+"&code_challenge=challenge&code_challenge_method=plain","twitter","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e),Promise.resolve()}catch(e){return Promise.reject(e)}},[h,f,r,k,c,P]);return o.createElement("div",{className:a,onClick:L},s)});"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var w=window,_=t.memo(function(e){var n=e.client_id,r=e.scope,i=void 0===r?"name email":r,a=e.className,c=void 0===a?"":a,s=e.onLoginStart,d=e.onReject,l=e.onResolve,u=e.redirect_uri,p=void 0===u?"/":u,f=e.children,m=t.useRef(null),h=t.useState(!1),v=h[0],g=h[1];t.useEffect(function(){!v&&y()},[v]),t.useEffect(function(){return function(){m.current&&m.current.remove()}},[]);var _=t.useCallback(function(){return!!document.getElementById("apple-login")},[]),k=t.useCallback(function(e,t,o,n,r){void 0===t&&(t="script");var i=e.createElement(t);i.id=o,i.src=n,i.async=!0,i.defer=!0;var a=document.getElementsByTagName("script")[0];m.current=i,a&&a.parentNode&&a.parentNode.insertBefore(i,a),i.onload=r},[]),b=t.useCallback(function(e){l({provider:"apple",data:e})},[l]),y=t.useCallback(function(){_()?g(!0):k(document,"script","apple-login","https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",function(){w.AppleID.auth.init({clientId:n,scope:i,redirectURI:p,state:"origin:web",usePopup:!0}),g(!0)})},[i,n,p,k,_]),C=t.useCallback(function(){try{if(!v)return Promise.resolve();var e=function(){if(w.AppleID){s&&s();var e=function(e,t){try{var o=Promise.resolve(w.AppleID.auth.signIn()).then(function(e){b(e)})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){d({err:e})});if(e&&e.then)return e.then(function(){})}else y(),d("Apple SDK isn't loaded!")}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[b,v,y,s,d]);return o.createElement("div",{className:c,onClick:C},f)}),k=t.memo(function(e){var n=e.state,r=void 0===n?"":n,i=e.scope,a=void 0===i?"user.info.basic":i,c=e.client_key,s=e.className,d=void 0===s?"":s,l=e.redirect_uri,u=e.children,p=e.onResolve,f=e.onLoginStart;t.useEffect(function(){var e=new URL(window.location.href),t=e.searchParams.get("code"),o=e.searchParams.get("state");null!=o&&o.includes("_tiktok")&&t&&(localStorage.setItem("tiktok",t),window.close())},[]);var m=t.useCallback(function(e){var t=e.type,o=e.code,n=e.provider;try{return Promise.resolve("code"===t&&"tiktok"===n&&o&&p({provider:"tiktok",data:{code:o}}))}catch(e){return Promise.reject(e)}},[p]),h=t.useCallback(function(){window.removeEventListener("storage",h,!1);var e=localStorage.getItem("tiktok");e&&(m({provider:"tiktok",type:"code",code:e}),localStorage.removeItem("instagram"))},[m]),v=t.useCallback(function(){f&&f(),window.addEventListener("storage",h,!1);var e=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.tiktok.com/v2/auth/authorize/?client_key="+c+"&scope="+a+"&state="+r+"_tiktok&redirect_uri="+l+"&response_type=code","Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+e)},[a,r,c,l,f,h]);return o.createElement("div",{className:d,onClick:v},u)});e.LoginSocialAmazon=a,e.LoginSocialApple=_,e.LoginSocialFacebook=s,e.LoginSocialGithub=p,e.LoginSocialGoogle=u,e.LoginSocialInstagram=f,e.LoginSocialLinkedin=h,e.LoginSocialMicrosoft=m,e.LoginSocialPinterest=v,e.LoginSocialTiktok=k,e.LoginSocialTwitter=g});