New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@clerk/clerk-react

Package Overview
Dependencies
Maintainers
9
Versions
2712
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 3.2.1 to 3.2.2-staging.0

4

dist/contexts/ClerkProvider.js

@@ -14,4 +14,4 @@ "use strict";

const clerk = (0, react_1.useMemo)(() => {
const { frontendApi = '', Clerk: ClerkConstructor, initialState } = props, rest = tslib_1.__rest(props, ["frontendApi", "Clerk", "initialState"]);
return new isomorphicClerk_1.default(frontendApi, rest, ClerkConstructor, initialState);
const { frontendApi = '', Clerk: ClerkConstructor, initialState } = props, options = tslib_1.__rest(props, ["frontendApi", "Clerk", "initialState"]);
return isomorphicClerk_1.default.getOrCreateInstance({ frontendApi, options, Clerk: ClerkConstructor, initialState });
}, []);

@@ -18,0 +18,0 @@ (0, react_1.useEffect)(() => {

/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */
export declare const LIB_VERSION = "3.2.1";
export declare const LIB_VERSION = "3.2.2-staging.0";
export declare const LIB_NAME = "@clerk/clerk-react";
//# sourceMappingURL=info.d.ts.map

@@ -5,4 +5,4 @@ "use strict";

/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */
exports.LIB_VERSION = '3.2.1';
exports.LIB_VERSION = '3.2.2-staging.0';
exports.LIB_NAME = '@clerk/clerk-react';
//# sourceMappingURL=info.js.map

@@ -6,3 +6,10 @@ import type { ActiveSessionResource, AuthenticateWithMetamaskParams, ClientResource, CreateOrganizationParams, HandleMagicLinkVerificationParams, HandleOAuthCallbackParams, InitialState, OrganizationMembershipResource, OrganizationResource, RedirectOptions, Resources, SignInProps, SignOut, SignUpProps, UserButtonProps, UserProfileProps, UserResource } from '@clerk/types';

}
declare type NewIsomorphicClerkParams = {
frontendApi: string;
options: IsomorphicClerkOptions;
Clerk: ClerkProp | null;
initialState?: InitialState;
};
export default class IsomorphicClerk {
#private;
private mode;

@@ -21,6 +28,6 @@ private frontendApi;

private loadedListeners;
private _loaded;
initialState: InitialState | undefined;
get loaded(): boolean;
constructor(frontendApi: string, options?: IsomorphicClerkOptions, Clerk?: ClerkProp, initialState?: InitialState);
static getOrCreateInstance(params: NewIsomorphicClerkParams): IsomorphicClerk;
constructor(params: NewIsomorphicClerkParams);
loadClerkJS(): Promise<BrowserClerk | undefined>;

@@ -62,2 +69,3 @@ addOnLoaded: (cb: () => void) => void;

}
export {};
//# sourceMappingURL=isomorphicClerk.d.ts.map
"use strict";
var _a, _IsomorphicClerk_loaded, _IsomorphicClerk_instance;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const errors_1 = require("./errors");
const utils_1 = require("./utils");
class IsomorphicClerk {
constructor(frontendApi, options = {}, Clerk = null, initialState) {
constructor(params) {
this.clerkjs = null;

@@ -16,3 +18,3 @@ this.preopenSignIn = null;

this.loadedListeners = [];
this._loaded = false;
_IsomorphicClerk_loaded.set(this, false);
this.addOnLoaded = (cb) => {

@@ -49,3 +51,3 @@ this.loadedListeners.push(cb);

});
this._loaded = true;
tslib_1.__classPrivateFieldSet(this, _IsomorphicClerk_loaded, true, "f");
this.emitLoaded();

@@ -63,3 +65,3 @@ return this.clerkjs;

this.openSignIn = (props) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.openSignIn(props);

@@ -72,3 +74,3 @@ }

this.closeSignIn = () => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.closeSignIn();

@@ -81,3 +83,3 @@ }

this.openSignUp = (props) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.openSignUp(props);

@@ -90,3 +92,3 @@ }

this.closeSignUp = () => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.closeSignUp();

@@ -99,3 +101,3 @@ }

this.mountSignIn = (node, props) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.mountSignIn(node, props);

@@ -108,3 +110,3 @@ }

this.unmountSignIn = (node) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.unmountSignIn(node);

@@ -117,3 +119,3 @@ }

this.mountSignUp = (node, props) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.mountSignUp(node, props);

@@ -126,3 +128,3 @@ }

this.unmountSignUp = (node) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.unmountSignUp(node);

@@ -135,3 +137,3 @@ }

this.mountUserProfile = (node, props) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.mountUserProfile(node, props);

@@ -144,3 +146,3 @@ }

this.unmountUserProfile = (node) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.unmountUserProfile(node);

@@ -153,3 +155,3 @@ }

this.mountUserButton = (node, userButtonProps) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.mountUserButton(node, userButtonProps);

@@ -162,3 +164,3 @@ }

this.unmountUserButton = (node) => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
this.clerkjs.unmountUserButton(node);

@@ -171,3 +173,3 @@ }

this.addListener = (listener) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.addListener(listener); };
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.addListener(listener); };
if (this.clerkjs) {

@@ -181,4 +183,4 @@ callback();

this.navigate = (to) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.navigate(to); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.navigate(to); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
void callback();

@@ -191,4 +193,4 @@ }

this.redirectToSignIn = (opts) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.redirectToSignIn(opts); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.redirectToSignIn(opts); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
void callback();

@@ -201,4 +203,4 @@ }

this.redirectToSignUp = (opts) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.redirectToSignUp(opts); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.redirectToSignUp(opts); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
void callback();

@@ -211,4 +213,4 @@ }

this.redirectToUserProfile = () => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.redirectToUserProfile(); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.redirectToUserProfile(); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
callback();

@@ -221,4 +223,4 @@ }

this.handleRedirectCallback = (params) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.handleRedirectCallback(params); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.handleRedirectCallback(params); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
void callback();

@@ -231,4 +233,4 @@ }

this.handleMagicLinkVerification = async (params) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.handleMagicLinkVerification(params); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.handleMagicLinkVerification(params); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
return callback();

@@ -241,4 +243,4 @@ }

this.authenticateWithMetamask = async (params) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.authenticateWithMetamask(params); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.authenticateWithMetamask(params); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
return callback();

@@ -251,4 +253,4 @@ }

this.createOrganization = async (params) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.createOrganization(params); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.createOrganization(params); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
return callback();

@@ -261,4 +263,4 @@ }

this.getOrganizationMemberships = async () => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.getOrganizationMemberships(); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.getOrganizationMemberships(); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
return callback();

@@ -271,4 +273,4 @@ }

this.getOrganization = async (organizationId) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.getOrganization(organizationId); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.getOrganization(organizationId); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
return callback();

@@ -281,4 +283,4 @@ }

this.signOut = async (signOutCallbackOrOptions, options) => {
const callback = () => { var _a; return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.signOut(signOutCallbackOrOptions, options); };
if (this.clerkjs && this._loaded) {
const callback = () => { var _b; return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.signOut(signOutCallbackOrOptions, options); };
if (this.clerkjs && tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
return callback();

@@ -290,2 +292,6 @@ }

};
if (tslib_1.__classPrivateFieldGet(IsomorphicClerk, _a, "f", _IsomorphicClerk_instance)) {
throw new Error('An IsomorphicClerk instance already exists. Use IsomorphicClerk.getOrCreateInstance instead');
}
const { Clerk = null, frontendApi, initialState, options = {} } = params || {};
this.frontendApi = frontendApi;

@@ -298,5 +304,14 @@ this.options = options;

get loaded() {
return this._loaded;
return tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f");
}
static getOrCreateInstance(params) {
if (!tslib_1.__classPrivateFieldGet(this, _a, "f", _IsomorphicClerk_instance)) {
tslib_1.__classPrivateFieldSet(this, _a, new IsomorphicClerk(params), "f", _IsomorphicClerk_instance);
}
return tslib_1.__classPrivateFieldGet(this, _a, "f", _IsomorphicClerk_instance);
}
async loadClerkJS() {
if (tslib_1.__classPrivateFieldGet(this, _IsomorphicClerk_loaded, "f")) {
return;
}
if (!this.frontendApi) {

@@ -360,4 +375,4 @@ this.throwError(errors_1.noFrontendApiError);

get version() {
var _a;
return (_a = this.clerkjs) === null || _a === void 0 ? void 0 : _a.version;
var _b;
return (_b = this.clerkjs) === null || _b === void 0 ? void 0 : _b.version;
}

@@ -402,2 +417,4 @@ get client() {

exports.default = IsomorphicClerk;
_a = IsomorphicClerk, _IsomorphicClerk_loaded = new WeakMap();
_IsomorphicClerk_instance = { value: void 0 };
//# sourceMappingURL=isomorphicClerk.js.map
{
"name": "@clerk/clerk-react",
"version": "3.2.1",
"version": "3.2.2-staging.0",
"license": "MIT",

@@ -70,3 +70,3 @@ "description": "Clerk.dev React library",

"homepage": "https://clerk.dev/",
"gitHead": "52431beabca9a40d362f792e7fb8137132d62c16"
"gitHead": "0516fcd72a0b105cb9adcbc9c5b4b0d8d00eeec6"
}
/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */
export const LIB_VERSION = '3.2.1';
export const LIB_VERSION = '3.2.2-staging.0';
export const LIB_NAME = '@clerk/clerk-react';

@@ -38,2 +38,9 @@ import type {

type NewIsomorphicClerkParams = {
frontendApi: string;
options: IsomorphicClerkOptions;
Clerk: ClerkProp | null;
initialState?: InitialState;
};
export default class IsomorphicClerk {

@@ -54,3 +61,3 @@ private mode: string;

private _loaded = false;
#loaded = false;

@@ -60,11 +67,20 @@ initialState: InitialState | undefined;

get loaded(): boolean {
return this._loaded;
return this.#loaded;
}
constructor(
frontendApi: string,
options: IsomorphicClerkOptions = {},
Clerk: ClerkProp = null,
initialState?: InitialState,
) {
static #instance: IsomorphicClerk;
static getOrCreateInstance(params: NewIsomorphicClerkParams) {
if (!this.#instance) {
this.#instance = new IsomorphicClerk(params);
}
return this.#instance;
}
constructor(params: NewIsomorphicClerkParams) {
if (IsomorphicClerk.#instance) {
throw new Error('An IsomorphicClerk instance already exists. Use IsomorphicClerk.getOrCreateInstance instead');
}
const { Clerk = null, frontendApi, initialState, options = {} } = params || {};
this.frontendApi = frontendApi;

@@ -78,2 +94,6 @@ this.options = options;

async loadClerkJS(): Promise<BrowserClerk | undefined> {
if (this.#loaded) {
return;
}
if (!this.frontendApi) {

@@ -185,3 +205,3 @@ this.throwError(noFrontendApiError);

this._loaded = true;
this.#loaded = true;
this.emitLoaded();

@@ -243,3 +263,3 @@ return this.clerkjs;

openSignIn = (props?: SignInProps): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.openSignIn(props);

@@ -252,3 +272,3 @@ } else {

closeSignIn = (): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.closeSignIn();

@@ -261,3 +281,3 @@ } else {

openSignUp = (props?: SignUpProps): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.openSignUp(props);

@@ -270,3 +290,3 @@ } else {

closeSignUp = (): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.closeSignUp();

@@ -279,3 +299,3 @@ } else {

mountSignIn = (node: HTMLDivElement, props: SignInProps): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.mountSignIn(node, props);

@@ -288,3 +308,3 @@ } else {

unmountSignIn = (node: HTMLDivElement): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.unmountSignIn(node);

@@ -297,3 +317,3 @@ } else {

mountSignUp = (node: HTMLDivElement, props: SignUpProps): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.mountSignUp(node, props);

@@ -306,3 +326,3 @@ } else {

unmountSignUp = (node: HTMLDivElement): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.unmountSignUp(node);

@@ -315,3 +335,3 @@ } else {

mountUserProfile = (node: HTMLDivElement, props: UserProfileProps): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.mountUserProfile(node, props);

@@ -324,3 +344,3 @@ } else {

unmountUserProfile = (node: HTMLDivElement): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.unmountUserProfile(node);

@@ -333,3 +353,3 @@ } else {

mountUserButton = (node: HTMLDivElement, userButtonProps: UserButtonProps): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.mountUserButton(node, userButtonProps);

@@ -342,3 +362,3 @@ } else {

unmountUserButton = (node: HTMLDivElement): void => {
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
this.clerkjs.unmountUserButton(node);

@@ -361,3 +381,3 @@ } else {

const callback = () => this.clerkjs?.navigate(to);
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
void callback();

@@ -371,3 +391,3 @@ } else {

const callback = () => this.clerkjs?.redirectToSignIn(opts as any);
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
void callback();

@@ -381,3 +401,3 @@ } else {

const callback = () => this.clerkjs?.redirectToSignUp(opts as any);
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
void callback();

@@ -391,3 +411,3 @@ } else {

const callback = () => this.clerkjs?.redirectToUserProfile();
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
callback();

@@ -401,3 +421,3 @@ } else {

const callback = () => this.clerkjs?.handleRedirectCallback(params);
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
void callback();

@@ -411,3 +431,3 @@ } else {

const callback = () => this.clerkjs?.handleMagicLinkVerification(params);
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
return callback() as Promise<void>;

@@ -421,3 +441,3 @@ } else {

const callback = () => this.clerkjs?.authenticateWithMetamask(params);
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
return callback() as Promise<void>;

@@ -431,3 +451,3 @@ } else {

const callback = () => this.clerkjs?.createOrganization(params);
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
return callback() as Promise<OrganizationResource>;

@@ -441,3 +461,3 @@ } else {

const callback = () => this.clerkjs?.getOrganizationMemberships();
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
return callback() as Promise<OrganizationMembershipResource[]>;

@@ -451,3 +471,3 @@ } else {

const callback = () => this.clerkjs?.getOrganization(organizationId);
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
return callback() as Promise<OrganizationResource | undefined>;

@@ -464,3 +484,3 @@ } else {

const callback = () => this.clerkjs?.signOut(signOutCallbackOrOptions as any, options);
if (this.clerkjs && this._loaded) {
if (this.clerkjs && this.#loaded) {
return callback() as Promise<void>;

@@ -467,0 +487,0 @@ } else {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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