Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@clerk/clerk-react

Package Overview
Dependencies
Maintainers
4
Versions
2486
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clerk/clerk-react - npm Package Compare versions

Comparing version 1.6.1-staging.0 to 1.7.0

2

dist/clerk-react.cjs.development.js

@@ -69,3 +69,3 @@ 'use strict';

var version = "1.6.1-staging.0";
var version = "1.7.0";

@@ -72,0 +72,0 @@ var FAILED_TO_LOAD_ERROR = 'Clerk: Failed to load Clerk';

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e;function t(){return(t=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function o(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}function i(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)r.indexOf(n=i[t])>=0||(o[n]=e[n]);return o}function s(){return"undefined"!=typeof window}var l="Clerk: You must wrap your application in a <ClerkProvider> component.",u=function(){function e(e,r,n){var t=this,o=this;void 0===r&&(r={}),this.listeners=[],this.clerkjs=null,this.preopenSignIn=null,this.preopenSignUp=null,this.premountSignInNodes=new Map,this.premountSignUpNodes=new Map,this.premountUserProfileNodes=new Map,this.premountUserButtonNodes=new Map,this.premountMethodCalls=new Map,this._loaded=!1,this.ssrData=null,this.hydrateClerkJS=function(e){try{if(!e)throw new Error("Failed to hydrate latest Clerk JS");return o.clerkjs=e,o.listeners.forEach((function(r){e.addListener(r)})),null!==o.preopenSignIn&&e.openSignIn(o.preopenSignIn),null!==o.preopenSignUp&&e.openSignUp(o.preopenSignUp),o.premountSignInNodes.forEach((function(r,n){e.mountSignIn(n,r)})),o.premountSignUpNodes.forEach((function(r,n){e.mountSignUp(n,r)})),o.premountUserProfileNodes.forEach((function(r,n){e.mountUserProfile(n,r)})),o.premountUserButtonNodes.forEach((function(r,n){e.mountUserButton(n,r)})),o.premountMethodCalls.forEach((function(e){return e()})),o._loaded=!0,Promise.resolve(o.clerkjs)}catch(e){return Promise.reject(e)}},this.setSession=function(e,r){return t.clerkjs?t.clerkjs.setSession(e,r):Promise.reject()},this.openSignIn=function(e){t.clerkjs&&t._loaded?t.clerkjs.openSignIn(e):t.preopenSignIn=e},this.closeSignIn=function(){t.clerkjs&&t._loaded?t.clerkjs.closeSignIn():t.preopenSignIn=null},this.openSignUp=function(e){t.clerkjs&&t._loaded?t.clerkjs.openSignUp(e):t.preopenSignUp=e},this.closeSignUp=function(){t.clerkjs&&t._loaded?t.clerkjs.closeSignUp():t.preopenSignUp=null},this.mountSignIn=function(e,r){t.clerkjs&&t._loaded?t.clerkjs.mountSignIn(e,r):t.premountSignInNodes.set(e,r)},this.unmountSignIn=function(e){t.clerkjs&&t._loaded?t.clerkjs.unmountSignIn(e):t.premountSignInNodes.delete(e)},this.mountSignUp=function(e,r){t.clerkjs&&t._loaded?t.clerkjs.mountSignUp(e,r):t.premountSignUpNodes.set(e,r)},this.unmountSignUp=function(e){t.clerkjs&&t._loaded?t.clerkjs.unmountSignUp(e):t.premountSignUpNodes.delete(e)},this.mountUserProfile=function(e,r){t.clerkjs&&t._loaded?t.clerkjs.mountUserProfile(e,r):t.premountUserProfileNodes.set(e,r)},this.unmountUserProfile=function(e){t.clerkjs&&t._loaded?t.clerkjs.unmountUserProfile(e):t.premountUserProfileNodes.delete(e)},this.mountUserButton=function(e,r){t.clerkjs&&t._loaded?t.clerkjs.mountUserButton(e,r):t.premountUserButtonNodes.set(e,r)},this.unmountUserButton=function(e){t.clerkjs&&t._loaded?t.clerkjs.unmountUserButton(e):t.premountUserButtonNodes.delete(e)},this.addListener=function(e){t.clerkjs?t.clerkjs.addListener(e):t.listeners.push(e)},this.loadFromServer=function(e){"browser"===t.mode&&t.throwError("loadFromServer cannot be called in a browser context."),t.ssrData=JSON.stringify({client:t.client,session:t.session,token:e})},this.navigate=function(e){var r=function(){var r;return null===(r=t.clerkjs)||void 0===r?void 0:r.navigate(e)};t.clerkjs&&t._loaded?r():t.premountMethodCalls.set("navigate",r)},this.redirectToSignIn=function(){var e=function(){var e;return null===(e=t.clerkjs)||void 0===e?void 0:e.redirectToSignIn()};t.clerkjs&&t._loaded?e():t.premountMethodCalls.set("redirectToSignIn",e)},this.redirectToSignUp=function(){var e=function(){var e;return null===(e=t.clerkjs)||void 0===e?void 0:e.redirectToSignUp()};t.clerkjs&&t._loaded?e():t.premountMethodCalls.set("redirectToSignUp",e)},this.redirectToUserProfile=function(){var e=function(){var e;return null===(e=t.clerkjs)||void 0===e?void 0:e.redirectToUserProfile()};t.clerkjs&&t._loaded?e():t.premountMethodCalls.set("redirectToUserProfile",e)},this.frontendApi=e,this.options=r,this.ClerkConstructor=n,this.mode=s()?"browser":"server"}var r,n=e.prototype;return n.loadClerkJS=function(){var e,r,n=this;return this.frontendApi?this.ClerkConstructor?(window.Clerk=new this.ClerkConstructor(this.frontendApi),window.Clerk.load(this.options).then((function(){return n.hydrateClerkJS(window.Clerk)})).catch((function(e){return n.throwError(e.message||e)}))):(e=this.frontendApi,r=this.options.scriptUrl,new Promise((function(n,t){window.Clerk&&n(null),e||t("Clerk: Missing provider");var o=document.createElement("script"),i=function(e,r){if(r)return r;var n=function(e){return e.endsWith(".lclstage.dev")||e.endsWith(".stgstage.dev")||e.endsWith(".clerkstage.dev")}(e)?"staging":parseInt("1.6.1-staging.0".split(".")[0],10);return"https://"+e+"/npm/@clerk/clerk-js@"+n+"/dist/clerk.browser.js"}(e,r);o.setAttribute("data-clerk-frontend-api",e),o.setAttribute("crossorigin","anonymous"),o.async=!0,document.body||t("Clerk: Missing <body> element."),o.addEventListener("load",(function(){return n(o)})),o.addEventListener("error",(function(){return t("Clerk: Failed to load Clerk")})),o.src=i,document.body.appendChild(o)}))).then((function(){if(window.Clerk)return window.Clerk.load(n.options);throw new Error("Failed to download latest Clerk JS")})).then((function(){return n.hydrateClerkJS(window.Clerk)})).catch((function(e){return n.throwError(e.message||e)})):(this.throwError("Clerk: You must add the frontendApi prop to your <ClerkProvider>"),Promise.resolve())},n.throwError=function(e){return console.error(e),Promise.resolve()},(r=[{key:"client",get:function(){return this.clerkjs?this.clerkjs.client:void 0}},{key:"session",get:function(){return this.clerkjs?this.clerkjs.session:void 0}},{key:"user",get:function(){return this.clerkjs?this.clerkjs.user:void 0}},{key:"environment",get:function(){return this.clerkjs?this.clerkjs.environment:void 0}}])&&function(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}(e.prototype,r),e}(),c=n.createContext(void 0);c.displayName="ClerkContext";var a=function(e){function r(r){var n;(n=e.call(this,r)||this).onClerkEvent=function(e){n.setState({client:e.client,session:e.session,user:e.user})};var t=r.frontendApi,o=void 0===t?"":t,s=r.Clerk,l=i(r,["frontendApi","Clerk"]);return n.clerk=new u(o,l,s),n.state={client:void 0,session:void 0,user:void 0},n}o(r,e);var t=r.prototype;return t.loadClerk=function(){var e=this;this.clerk.loadClerkJS().then((function(){e.setState({client:e.clerk.client,session:e.clerk.session,user:e.clerk.user})}))},t.componentDidMount=function(){this.loadClerk(),this.clerk&&this.clerk.addListener(this.onClerkEvent)},t.defaultInitialUser=function(e){var r=e.sessions.find((function(e){return"active"===e.status}));return r?r.user:null},t.render=function(){var e=this.state.session;return n.createElement(c.Provider,{value:{guaranteedLoaded:!1,guaranteedUser:!1,clerk:this.clerk}},this.clerk instanceof u&&this.clerk.ssrData&&n.createElement("script",{type:"application/json","data-clerk":"SSR",dangerouslySetInnerHTML:{__html:this.clerk.ssrData}}),n.createElement(n.Fragment,{key:e?e.id:"no-usrses"},this.props.children))},r}(n.PureComponent),d=function(e,o){e.displayName=o=o||e.displayName||e.name||"Component";var i=function(o){var i=r.useContext(c);if(i)return i.clerk&&void 0===i.clerk.session?null:i.guaranteedLoaded?n.createElement(e,Object.assign({},o,{clerk:i.clerk})):i.clerk.client?n.createElement(c.Provider,{value:t({},i,{guaranteedLoaded:!0})},n.createElement(e,Object.assign({},o,{clerk:i.clerk}))):null;if(s())throw new Error(l);return null};return i.displayName="withClerk("+o+")",i},p=function(e,o){e.displayName=o=o||e.displayName||e.name||"Component";var i=function(o){var i=r.useContext(c);if(i)return i.guaranteedUser&&i.clerk.session?n.createElement(e,Object.assign({},o,{user:i.clerk.session.user})):i.clerk.client&&i.clerk.session?n.createElement(c.Provider,{value:t({},i,{guaranteedLoaded:!0,guaranteedUser:!0})},n.createElement(e,Object.assign({},o,{user:i.clerk.session.user}))):null;if(s())throw new Error(l);return null};return i.displayName="withUser("+o+")",i},f=function(e){function r(){var r;return(r=e.apply(this,arguments)||this).portalRef=n.createRef(),r}o(r,e);var t=r.prototype;return t.componentDidMount=function(){this.portalRef.current&&this.props.mount(this.portalRef.current,this.props.props)},t.componentWillUnmount=function(){this.portalRef.current&&this.props.unmount(this.portalRef.current)},t.render=function(){return n.createElement("div",{ref:this.portalRef})},r}(n.PureComponent),k=d((function(e){var r=e.clerk,t=i(e,["clerk"]);return n.createElement(f,{mount:r.mountSignIn,unmount:r.unmountSignIn,props:t})}),"SignIn"),h=d((function(e){var r=e.clerk,t=i(e,["clerk"]);return n.createElement(f,{mount:r.mountSignUp,unmount:r.unmountSignUp,props:t})}),"SignUp"),m=d((function(e){var r=e.clerk,t=i(e,["clerk"]);return n.createElement(f,{mount:r.mountUserProfile,unmount:r.unmountUserProfile,props:t})}),"UserProfile"),g=d((function(e){var r=e.clerk,t=i(e,["clerk"]);return n.createElement(f,{mount:r.mountUserButton,unmount:r.unmountUserButton,props:t})}),"UserButton"),v=p((function(e){return n.createElement(n.Fragment,null,e.children)}),"SignedIn"),S=d((function(e){return null===e.clerk.session?n.createElement(n.Fragment,null,e.children):null}),"SignedOut"),C=d((function(e){return n.createElement(n.Fragment,null,e.children)}),"ClerkLoaded"),U=d((function(e){var r=e.clerk;return n.useEffect((function(){r.redirectToSignIn()}),[]),null}),"RedirectToSignIn"),w=d((function(e){var r=e.clerk;return n.useEffect((function(){r.redirectToSignUp()}),[]),null}),"RedirectToSignUp"),j=d((function(e){var r=e.clerk;return n.useEffect((function(){r.redirectToUserProfile()}),[]),null}),"redirectToUserProfile");exports.ClerkContext=c,exports.ClerkLoaded=C,exports.ClerkProvider=a,exports.RedirectToSignIn=U,exports.RedirectToSignUp=w,exports.RedirectToUserProfile=j,exports.SignIn=k,exports.SignUp=h,exports.SignedIn=v,exports.SignedOut=S,exports.UserButton=g,exports.UserProfile=m,exports.WithClerk=function(e){var r=e.children;return n.createElement(c.Consumer,null,(function(e){if("function"==typeof r){if(e)return e.clerk&&void 0===e.clerk.session?null:e.guaranteedLoaded?r(e.clerk):e.clerk.client?n.createElement(c.Provider,{value:t({},e,{guaranteedLoaded:!0})},r(e.clerk)):null;throw new Error(l)}throw new Error("Clerk: Child of WithClerk must be a function.")}))},exports.WithUser=function(e){var r=e.children;return n.createElement(c.Consumer,null,(function(e){if("function"==typeof r){if(e)return e.guaranteedUser&&e.clerk.session?r(e.clerk.session.user):e.clerk.client&&e.clerk.session?n.createElement(c.Provider,{value:t({},e,{guaranteedLoaded:!0,guaranteedUser:!0})},r(e.clerk.session.user)):null;throw new Error(l)}throw new Error("Clerk: Child of WithClerk must be a function.")}))},exports.useClerk=function(){var e=r.useContext(c);if(e){if(e.guaranteedLoaded)return e.clerk;throw new Error("Clerk: You're calling useClerk() before there's a guarantee the client has been loaded. Call useClerk() from a child of <SignedIn>, <SignedOut>, or <ClerkLoaded>, or use the withClerk() HOC.")}throw new Error(l)},exports.useUser=function(){var e=r.useContext(c);if(e){if(e.guaranteedUser&&e.clerk.session)return e.clerk.session.user;throw new Error("Clerk: You're calling useUser() before there's a guarantee there's an active user. Call useUser() from a child of <SignedIn> or use the withUser() HOC.")}throw new Error(l)},exports.withClerk=d,exports.withUser=p;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e;function t(){return(t=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function o(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}function i(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)r.indexOf(n=i[t])>=0||(o[n]=e[n]);return o}function s(){return"undefined"!=typeof window}var l="Clerk: You must wrap your application in a <ClerkProvider> component.",u=function(){function e(e,r,n){var t=this,o=this;void 0===r&&(r={}),this.listeners=[],this.clerkjs=null,this.preopenSignIn=null,this.preopenSignUp=null,this.premountSignInNodes=new Map,this.premountSignUpNodes=new Map,this.premountUserProfileNodes=new Map,this.premountUserButtonNodes=new Map,this.premountMethodCalls=new Map,this._loaded=!1,this.ssrData=null,this.hydrateClerkJS=function(e){try{if(!e)throw new Error("Failed to hydrate latest Clerk JS");return o.clerkjs=e,o.listeners.forEach((function(r){e.addListener(r)})),null!==o.preopenSignIn&&e.openSignIn(o.preopenSignIn),null!==o.preopenSignUp&&e.openSignUp(o.preopenSignUp),o.premountSignInNodes.forEach((function(r,n){e.mountSignIn(n,r)})),o.premountSignUpNodes.forEach((function(r,n){e.mountSignUp(n,r)})),o.premountUserProfileNodes.forEach((function(r,n){e.mountUserProfile(n,r)})),o.premountUserButtonNodes.forEach((function(r,n){e.mountUserButton(n,r)})),o.premountMethodCalls.forEach((function(e){return e()})),o._loaded=!0,Promise.resolve(o.clerkjs)}catch(e){return Promise.reject(e)}},this.setSession=function(e,r){return t.clerkjs?t.clerkjs.setSession(e,r):Promise.reject()},this.openSignIn=function(e){t.clerkjs&&t._loaded?t.clerkjs.openSignIn(e):t.preopenSignIn=e},this.closeSignIn=function(){t.clerkjs&&t._loaded?t.clerkjs.closeSignIn():t.preopenSignIn=null},this.openSignUp=function(e){t.clerkjs&&t._loaded?t.clerkjs.openSignUp(e):t.preopenSignUp=e},this.closeSignUp=function(){t.clerkjs&&t._loaded?t.clerkjs.closeSignUp():t.preopenSignUp=null},this.mountSignIn=function(e,r){t.clerkjs&&t._loaded?t.clerkjs.mountSignIn(e,r):t.premountSignInNodes.set(e,r)},this.unmountSignIn=function(e){t.clerkjs&&t._loaded?t.clerkjs.unmountSignIn(e):t.premountSignInNodes.delete(e)},this.mountSignUp=function(e,r){t.clerkjs&&t._loaded?t.clerkjs.mountSignUp(e,r):t.premountSignUpNodes.set(e,r)},this.unmountSignUp=function(e){t.clerkjs&&t._loaded?t.clerkjs.unmountSignUp(e):t.premountSignUpNodes.delete(e)},this.mountUserProfile=function(e,r){t.clerkjs&&t._loaded?t.clerkjs.mountUserProfile(e,r):t.premountUserProfileNodes.set(e,r)},this.unmountUserProfile=function(e){t.clerkjs&&t._loaded?t.clerkjs.unmountUserProfile(e):t.premountUserProfileNodes.delete(e)},this.mountUserButton=function(e,r){t.clerkjs&&t._loaded?t.clerkjs.mountUserButton(e,r):t.premountUserButtonNodes.set(e,r)},this.unmountUserButton=function(e){t.clerkjs&&t._loaded?t.clerkjs.unmountUserButton(e):t.premountUserButtonNodes.delete(e)},this.addListener=function(e){t.clerkjs?t.clerkjs.addListener(e):t.listeners.push(e)},this.loadFromServer=function(e){"browser"===t.mode&&t.throwError("loadFromServer cannot be called in a browser context."),t.ssrData=JSON.stringify({client:t.client,session:t.session,token:e})},this.navigate=function(e){var r=function(){var r;return null===(r=t.clerkjs)||void 0===r?void 0:r.navigate(e)};t.clerkjs&&t._loaded?r():t.premountMethodCalls.set("navigate",r)},this.redirectToSignIn=function(){var e=function(){var e;return null===(e=t.clerkjs)||void 0===e?void 0:e.redirectToSignIn()};t.clerkjs&&t._loaded?e():t.premountMethodCalls.set("redirectToSignIn",e)},this.redirectToSignUp=function(){var e=function(){var e;return null===(e=t.clerkjs)||void 0===e?void 0:e.redirectToSignUp()};t.clerkjs&&t._loaded?e():t.premountMethodCalls.set("redirectToSignUp",e)},this.redirectToUserProfile=function(){var e=function(){var e;return null===(e=t.clerkjs)||void 0===e?void 0:e.redirectToUserProfile()};t.clerkjs&&t._loaded?e():t.premountMethodCalls.set("redirectToUserProfile",e)},this.frontendApi=e,this.options=r,this.ClerkConstructor=n,this.mode=s()?"browser":"server"}var r,n=e.prototype;return n.loadClerkJS=function(){var e,r,n=this;return this.frontendApi?this.ClerkConstructor?(window.Clerk=new this.ClerkConstructor(this.frontendApi),window.Clerk.load(this.options).then((function(){return n.hydrateClerkJS(window.Clerk)})).catch((function(e){return n.throwError(e.message||e)}))):(e=this.frontendApi,r=this.options.scriptUrl,new Promise((function(n,t){window.Clerk&&n(null),e||t("Clerk: Missing provider");var o=document.createElement("script"),i=function(e,r){if(r)return r;var n=function(e){return e.endsWith(".lclstage.dev")||e.endsWith(".stgstage.dev")||e.endsWith(".clerkstage.dev")}(e)?"staging":parseInt("1.7.0".split(".")[0],10);return"https://"+e+"/npm/@clerk/clerk-js@"+n+"/dist/clerk.browser.js"}(e,r);o.setAttribute("data-clerk-frontend-api",e),o.setAttribute("crossorigin","anonymous"),o.async=!0,document.body||t("Clerk: Missing <body> element."),o.addEventListener("load",(function(){return n(o)})),o.addEventListener("error",(function(){return t("Clerk: Failed to load Clerk")})),o.src=i,document.body.appendChild(o)}))).then((function(){if(window.Clerk)return window.Clerk.load(n.options);throw new Error("Failed to download latest Clerk JS")})).then((function(){return n.hydrateClerkJS(window.Clerk)})).catch((function(e){return n.throwError(e.message||e)})):(this.throwError("Clerk: You must add the frontendApi prop to your <ClerkProvider>"),Promise.resolve())},n.throwError=function(e){return console.error(e),Promise.resolve()},(r=[{key:"client",get:function(){return this.clerkjs?this.clerkjs.client:void 0}},{key:"session",get:function(){return this.clerkjs?this.clerkjs.session:void 0}},{key:"user",get:function(){return this.clerkjs?this.clerkjs.user:void 0}},{key:"environment",get:function(){return this.clerkjs?this.clerkjs.environment:void 0}}])&&function(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}(e.prototype,r),e}(),c=n.createContext(void 0);c.displayName="ClerkContext";var a=function(e){function r(r){var n;(n=e.call(this,r)||this).onClerkEvent=function(e){n.setState({client:e.client,session:e.session,user:e.user})};var t=r.frontendApi,o=void 0===t?"":t,s=r.Clerk,l=i(r,["frontendApi","Clerk"]);return n.clerk=new u(o,l,s),n.state={client:void 0,session:void 0,user:void 0},n}o(r,e);var t=r.prototype;return t.loadClerk=function(){var e=this;this.clerk.loadClerkJS().then((function(){e.setState({client:e.clerk.client,session:e.clerk.session,user:e.clerk.user})}))},t.componentDidMount=function(){this.loadClerk(),this.clerk&&this.clerk.addListener(this.onClerkEvent)},t.defaultInitialUser=function(e){var r=e.sessions.find((function(e){return"active"===e.status}));return r?r.user:null},t.render=function(){var e=this.state.session;return n.createElement(c.Provider,{value:{guaranteedLoaded:!1,guaranteedUser:!1,clerk:this.clerk}},this.clerk instanceof u&&this.clerk.ssrData&&n.createElement("script",{type:"application/json","data-clerk":"SSR",dangerouslySetInnerHTML:{__html:this.clerk.ssrData}}),n.createElement(n.Fragment,{key:e?e.id:"no-usrses"},this.props.children))},r}(n.PureComponent),d=function(e,o){e.displayName=o=o||e.displayName||e.name||"Component";var i=function(o){var i=r.useContext(c);if(i)return i.clerk&&void 0===i.clerk.session?null:i.guaranteedLoaded?n.createElement(e,Object.assign({},o,{clerk:i.clerk})):i.clerk.client?n.createElement(c.Provider,{value:t({},i,{guaranteedLoaded:!0})},n.createElement(e,Object.assign({},o,{clerk:i.clerk}))):null;if(s())throw new Error(l);return null};return i.displayName="withClerk("+o+")",i},p=function(e,o){e.displayName=o=o||e.displayName||e.name||"Component";var i=function(o){var i=r.useContext(c);if(i)return i.guaranteedUser&&i.clerk.session?n.createElement(e,Object.assign({},o,{user:i.clerk.session.user})):i.clerk.client&&i.clerk.session?n.createElement(c.Provider,{value:t({},i,{guaranteedLoaded:!0,guaranteedUser:!0})},n.createElement(e,Object.assign({},o,{user:i.clerk.session.user}))):null;if(s())throw new Error(l);return null};return i.displayName="withUser("+o+")",i},f=function(e){function r(){var r;return(r=e.apply(this,arguments)||this).portalRef=n.createRef(),r}o(r,e);var t=r.prototype;return t.componentDidMount=function(){this.portalRef.current&&this.props.mount(this.portalRef.current,this.props.props)},t.componentWillUnmount=function(){this.portalRef.current&&this.props.unmount(this.portalRef.current)},t.render=function(){return n.createElement("div",{ref:this.portalRef})},r}(n.PureComponent),k=d((function(e){var r=e.clerk,t=i(e,["clerk"]);return n.createElement(f,{mount:r.mountSignIn,unmount:r.unmountSignIn,props:t})}),"SignIn"),h=d((function(e){var r=e.clerk,t=i(e,["clerk"]);return n.createElement(f,{mount:r.mountSignUp,unmount:r.unmountSignUp,props:t})}),"SignUp"),m=d((function(e){var r=e.clerk,t=i(e,["clerk"]);return n.createElement(f,{mount:r.mountUserProfile,unmount:r.unmountUserProfile,props:t})}),"UserProfile"),g=d((function(e){var r=e.clerk,t=i(e,["clerk"]);return n.createElement(f,{mount:r.mountUserButton,unmount:r.unmountUserButton,props:t})}),"UserButton"),v=p((function(e){return n.createElement(n.Fragment,null,e.children)}),"SignedIn"),S=d((function(e){return null===e.clerk.session?n.createElement(n.Fragment,null,e.children):null}),"SignedOut"),C=d((function(e){return n.createElement(n.Fragment,null,e.children)}),"ClerkLoaded"),U=d((function(e){var r=e.clerk;return n.useEffect((function(){r.redirectToSignIn()}),[]),null}),"RedirectToSignIn"),w=d((function(e){var r=e.clerk;return n.useEffect((function(){r.redirectToSignUp()}),[]),null}),"RedirectToSignUp"),j=d((function(e){var r=e.clerk;return n.useEffect((function(){r.redirectToUserProfile()}),[]),null}),"redirectToUserProfile");exports.ClerkContext=c,exports.ClerkLoaded=C,exports.ClerkProvider=a,exports.RedirectToSignIn=U,exports.RedirectToSignUp=w,exports.RedirectToUserProfile=j,exports.SignIn=k,exports.SignUp=h,exports.SignedIn=v,exports.SignedOut=S,exports.UserButton=g,exports.UserProfile=m,exports.WithClerk=function(e){var r=e.children;return n.createElement(c.Consumer,null,(function(e){if("function"==typeof r){if(e)return e.clerk&&void 0===e.clerk.session?null:e.guaranteedLoaded?r(e.clerk):e.clerk.client?n.createElement(c.Provider,{value:t({},e,{guaranteedLoaded:!0})},r(e.clerk)):null;throw new Error(l)}throw new Error("Clerk: Child of WithClerk must be a function.")}))},exports.WithUser=function(e){var r=e.children;return n.createElement(c.Consumer,null,(function(e){if("function"==typeof r){if(e)return e.guaranteedUser&&e.clerk.session?r(e.clerk.session.user):e.clerk.client&&e.clerk.session?n.createElement(c.Provider,{value:t({},e,{guaranteedLoaded:!0,guaranteedUser:!0})},r(e.clerk.session.user)):null;throw new Error(l)}throw new Error("Clerk: Child of WithClerk must be a function.")}))},exports.useClerk=function(){var e=r.useContext(c);if(e){if(e.guaranteedLoaded)return e.clerk;throw new Error("Clerk: You're calling useClerk() before there's a guarantee the client has been loaded. Call useClerk() from a child of <SignedIn>, <SignedOut>, or <ClerkLoaded>, or use the withClerk() HOC.")}throw new Error(l)},exports.useUser=function(){var e=r.useContext(c);if(e){if(e.guaranteedUser&&e.clerk.session)return e.clerk.session.user;throw new Error("Clerk: You're calling useUser() before there's a guarantee there's an active user. Call useUser() from a child of <SignedIn> or use the withUser() HOC.")}throw new Error(l)},exports.withClerk=d,exports.withUser=p;
//# sourceMappingURL=clerk-react.cjs.production.min.js.map

@@ -62,3 +62,3 @@ import React, { useContext } from 'react';

var version = "1.6.1-staging.0";
var version = "1.7.0";

@@ -65,0 +65,0 @@ var FAILED_TO_LOAD_ERROR = 'Clerk: Failed to load Clerk';

{
"name": "@clerk/clerk-react",
"version": "1.6.1-staging.0",
"version": "1.7.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Clerk.dev React library",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc