@tern-secure/react 1.2.0-canary.v20251019190011 → 1.2.0-canary.v20251020032343

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var S=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!p.call(r,i)&&i!==t&&u(r,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return r};var A=r=>f(u({},"__esModule",{value:!0}),r);var T={};S(T,{IsoTernSecureAuth:()=>h,inBrowser:()=>a});module.exports=A(T);var c=require("@tern-secure/auth"),s=require("@tern-secure/shared/ternStatusEvent"),o=require("@tern-secure/shared/utils");const g={name:"@tern-secure/react",version:"1.2.0-canary.v20251019190011",environment:process.env.NODE_ENV};function a(){return typeof window<"u"}class h{_mode;options;TernSecureAuth;ternauth=null;preAddListener=new Map;#i="loading";#s;#t;#n;#r=(0,s.createTernAuthEventBus)();static#e;get status(){return this.ternauth?this.ternauth.status||(this.ternauth.isReady?"ready":"loading"):this.#i}get isReady(){return this.ternauth?.isReady||!1}get isLoading(){return this.ternauth?.isLoading||!1}get requiresVerification(){return this.options.requiresVerification??!0}get signIn(){if(this.ternauth)return this.ternauth.signIn}get signUp(){if(this.ternauth)return this.ternauth.signUp}get user(){if(this.ternauth)return this.ternauth.user}static getOrCreateInstance(e){return(!a()||!this.#e||e.TernSecureAuth&&this.#e.TernSecureAuth!==e.TernSecureAuth)&&(this.#e=new h(e)),this.#e}static clearInstances(){this.#e&&(this.#e.ternauth=null,this.#e=null)}static clearInstance(){this.#e=null}get domain(){if(typeof window<"u"&&window.location)return(0,o.handleValueOrFn)(this.#t,new URL(window.location.href),"");if(typeof this.#t=="function")throw new Error("Unsupported customDomain type: function");return this.#t||""}get proxyUrl(){if(typeof window<"u"&&window.location)return(0,o.handleValueOrFn)(this.#n,new URL(window.location.href),"");if(typeof this.#n=="function")throw new Error("Unsupported customProxyUrl type: function");return this.#n||""}get mode(){return this._mode}_internal_getOption(e){return this.ternauth?._internal_getOption?this.ternauth?._internal_getOption(e):this.options[e]}_internal_getAllOptions(){return Object.freeze({...this.options})}constructor(e){const{TernSecureAuth:t=null}=e||{};this.#t=e.ternSecureConfig?.authDomain,this.options={...e},this._mode=a()?"browser":"server",this.#s=this.options.apiUrl,this.TernSecureAuth=t,this.options.sdkMetadata||(this.options.sdkMetadata=g),this.initTernSecureAuth()}get sdkMetadata(){return this.ternauth?.sdkMetadata||this.options.sdkMetadata}get version(){return this.ternauth?.version}get instanceType(){return this.ternauth?.instanceType}get apiUrl(){return this.#s||""}async initTernSecureAuth(){if(this._mode!=="browser"&&this.isReady)return;const e=c.TernSecureAuth.initialize(this.options);this.loadTernSecureAuth(e)}loadTernSecureAuth=e=>{if(!e)throw new Error("TernAuth instance is not initialized");return this.ternauth=e,this.preAddListener.forEach((t,n)=>{t.unsubscribe=e.addListener(n)}),this.#r.getListeners("status").forEach(t=>{this.on("status",t,{notify:!0})}),typeof this.ternauth.status>"u"&&(console.log("[IsoTernSecureAuth] TernSecureAuth has no status, setting internal status to ready"),this.#i="ready",this.#r.emit(s.ternEvents.Status,"ready")),this.ternauth};on=(...e)=>this.ternauth?.on?this.ternauth.on(...e):this.#r.on(...e);off=(...e)=>this.ternauth?.off?this.ternauth.off(...e):this.#r.off(...e);addListener=e=>{if(this.ternauth)return this.ternauth.addListener(e);{const t=()=>{const n=this.preAddListener.get(e);n&&(n.unsubscribe(),this.preAddListener.delete(e))};return this.preAddListener.set(e,{unsubscribe:t}),t}};createActiveSession=e=>this.ternauth?this.ternauth.createActiveSession(e):Promise.reject(new Error("TernSecureAuth not initialized"));signOut=async e=>{if(!this.ternauth)throw new Error("TernSecureAuth not initialized");await this.ternauth.signOut()};get currentSession(){return this.ternauth?this.ternauth.currentSession:null}onAuthStateChanged(e){return this.ternauth?this.ternauth.onAuthStateChanged(e):(console.warn("[IsoTernSecureAuth] TernAuth not initialized, cannot set up auth state listener"),()=>{})}getRedirectResult=async()=>{if(!this.ternauth?.getRedirectResult)throw new Error("TernSecure instance not initialized");return this.ternauth.getRedirectResult()};redirectToSignIn=async e=>{this.ternauth?.redirectToSignIn&&this.ternauth.redirectToSignIn(e)};redirectToSignUp=async e=>{this.ternauth?.redirectToSignUp&&this.ternauth.redirectToSignUp()};redirectAfterSignIn=e=>{this.ternauth?.redirectAfterSignIn&&this.ternauth.redirectAfterSignIn()};redirectAfterSignUp=e=>{this.ternauth?.redirectAfterSignUp&&this.ternauth.redirectAfterSignUp()};#u(){return new Promise(e=>{e(this.ternauth)})}initialize=async()=>{try{await this.#u()}catch(e){throw console.error("[IsomorphicTernSecure] Failed to initialize TernSecureAuth:",e),e}}}0&&(module.exports={IsoTernSecureAuth,inBrowser});
1
+ "use strict";var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var S=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!p.call(r,i)&&i!==t&&u(r,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return r};var A=r=>f(u({},"__esModule",{value:!0}),r);var T={};S(T,{IsoTernSecureAuth:()=>h,inBrowser:()=>a});module.exports=A(T);var c=require("@tern-secure/auth"),s=require("@tern-secure/shared/ternStatusEvent"),o=require("@tern-secure/shared/utils");const g={name:"@tern-secure/react",version:"1.2.0-canary.v20251020032343",environment:process.env.NODE_ENV};function a(){return typeof window<"u"}class h{_mode;options;TernSecureAuth;ternauth=null;preAddListener=new Map;#i="loading";#s;#t;#n;#r=(0,s.createTernAuthEventBus)();static#e;get status(){return this.ternauth?this.ternauth.status||(this.ternauth.isReady?"ready":"loading"):this.#i}get isReady(){return this.ternauth?.isReady||!1}get isLoading(){return this.ternauth?.isLoading||!1}get requiresVerification(){return this.options.requiresVerification??!0}get signIn(){if(this.ternauth)return this.ternauth.signIn}get signUp(){if(this.ternauth)return this.ternauth.signUp}get user(){if(this.ternauth)return this.ternauth.user}static getOrCreateInstance(e){return(!a()||!this.#e||e.TernSecureAuth&&this.#e.TernSecureAuth!==e.TernSecureAuth)&&(this.#e=new h(e)),this.#e}static clearInstances(){this.#e&&(this.#e.ternauth=null,this.#e=null)}static clearInstance(){this.#e=null}get domain(){if(typeof window<"u"&&window.location)return(0,o.handleValueOrFn)(this.#t,new URL(window.location.href),"");if(typeof this.#t=="function")throw new Error("Unsupported customDomain type: function");return this.#t||""}get proxyUrl(){if(typeof window<"u"&&window.location)return(0,o.handleValueOrFn)(this.#n,new URL(window.location.href),"");if(typeof this.#n=="function")throw new Error("Unsupported customProxyUrl type: function");return this.#n||""}get mode(){return this._mode}_internal_getOption(e){return this.ternauth?._internal_getOption?this.ternauth?._internal_getOption(e):this.options[e]}_internal_getAllOptions(){return Object.freeze({...this.options})}constructor(e){const{TernSecureAuth:t=null}=e||{};this.#t=e.ternSecureConfig?.authDomain,this.options={...e},this._mode=a()?"browser":"server",this.#s=this.options.apiUrl,this.TernSecureAuth=t,this.options.sdkMetadata||(this.options.sdkMetadata=g),this.initTernSecureAuth()}get sdkMetadata(){return this.ternauth?.sdkMetadata||this.options.sdkMetadata}get version(){return this.ternauth?.version}get instanceType(){return this.ternauth?.instanceType}get apiUrl(){return this.#s||""}async initTernSecureAuth(){if(this._mode!=="browser"&&this.isReady)return;const e=c.TernSecureAuth.initialize(this.options);this.loadTernSecureAuth(e)}loadTernSecureAuth=e=>{if(!e)throw new Error("TernAuth instance is not initialized");return this.ternauth=e,this.preAddListener.forEach((t,n)=>{t.unsubscribe=e.addListener(n)}),this.#r.getListeners("status").forEach(t=>{this.on("status",t,{notify:!0})}),typeof this.ternauth.status>"u"&&(console.log("[IsoTernSecureAuth] TernSecureAuth has no status, setting internal status to ready"),this.#i="ready",this.#r.emit(s.ternEvents.Status,"ready")),this.ternauth};on=(...e)=>this.ternauth?.on?this.ternauth.on(...e):this.#r.on(...e);off=(...e)=>this.ternauth?.off?this.ternauth.off(...e):this.#r.off(...e);addListener=e=>{if(this.ternauth)return this.ternauth.addListener(e);{const t=()=>{const n=this.preAddListener.get(e);n&&(n.unsubscribe(),this.preAddListener.delete(e))};return this.preAddListener.set(e,{unsubscribe:t}),t}};createActiveSession=e=>this.ternauth?this.ternauth.createActiveSession(e):Promise.reject(new Error("TernSecureAuth not initialized"));signOut=async e=>{if(!this.ternauth)throw new Error("TernSecureAuth not initialized");await this.ternauth.signOut()};get currentSession(){return this.ternauth?this.ternauth.currentSession:null}onAuthStateChanged(e){return this.ternauth?this.ternauth.onAuthStateChanged(e):(console.warn("[IsoTernSecureAuth] TernAuth not initialized, cannot set up auth state listener"),()=>{})}getRedirectResult=async()=>{if(!this.ternauth?.getRedirectResult)throw new Error("TernSecure instance not initialized");return this.ternauth.getRedirectResult()};redirectToSignIn=async e=>{this.ternauth?.redirectToSignIn&&this.ternauth.redirectToSignIn(e)};redirectToSignUp=async e=>{this.ternauth?.redirectToSignUp&&this.ternauth.redirectToSignUp()};redirectAfterSignIn=e=>{this.ternauth?.redirectAfterSignIn&&this.ternauth.redirectAfterSignIn()};redirectAfterSignUp=e=>{this.ternauth?.redirectAfterSignUp&&this.ternauth.redirectAfterSignUp()};#u(){return new Promise(e=>{e(this.ternauth)})}initialize=async()=>{try{await this.#u()}catch(e){throw console.error("[IsomorphicTernSecure] Failed to initialize TernSecureAuth:",e),e}}}0&&(module.exports={IsoTernSecureAuth,inBrowser});
2
2
  //# sourceMappingURL=isoTernSecureAuth.js.map
@@ -1,2 +1,2 @@
1
- import{TernSecureAuth as u}from"@tern-secure/auth";import{createTernAuthEventBus as o,ternEvents as a}from"@tern-secure/shared/ternStatusEvent";import{handleValueOrFn as n}from"@tern-secure/shared/utils";const h={name:"@tern-secure/react",version:"1.2.0-canary.v20251019190011",environment:process.env.NODE_ENV};function i(){return typeof window<"u"}class s{_mode;options;TernSecureAuth;ternauth=null;preAddListener=new Map;#i="loading";#s;#t;#n;#r=o();static#e;get status(){return this.ternauth?this.ternauth.status||(this.ternauth.isReady?"ready":"loading"):this.#i}get isReady(){return this.ternauth?.isReady||!1}get isLoading(){return this.ternauth?.isLoading||!1}get requiresVerification(){return this.options.requiresVerification??!0}get signIn(){if(this.ternauth)return this.ternauth.signIn}get signUp(){if(this.ternauth)return this.ternauth.signUp}get user(){if(this.ternauth)return this.ternauth.user}static getOrCreateInstance(e){return(!i()||!this.#e||e.TernSecureAuth&&this.#e.TernSecureAuth!==e.TernSecureAuth)&&(this.#e=new s(e)),this.#e}static clearInstances(){this.#e&&(this.#e.ternauth=null,this.#e=null)}static clearInstance(){this.#e=null}get domain(){if(typeof window<"u"&&window.location)return n(this.#t,new URL(window.location.href),"");if(typeof this.#t=="function")throw new Error("Unsupported customDomain type: function");return this.#t||""}get proxyUrl(){if(typeof window<"u"&&window.location)return n(this.#n,new URL(window.location.href),"");if(typeof this.#n=="function")throw new Error("Unsupported customProxyUrl type: function");return this.#n||""}get mode(){return this._mode}_internal_getOption(e){return this.ternauth?._internal_getOption?this.ternauth?._internal_getOption(e):this.options[e]}_internal_getAllOptions(){return Object.freeze({...this.options})}constructor(e){const{TernSecureAuth:t=null}=e||{};this.#t=e.ternSecureConfig?.authDomain,this.options={...e},this._mode=i()?"browser":"server",this.#s=this.options.apiUrl,this.TernSecureAuth=t,this.options.sdkMetadata||(this.options.sdkMetadata=h),this.initTernSecureAuth()}get sdkMetadata(){return this.ternauth?.sdkMetadata||this.options.sdkMetadata}get version(){return this.ternauth?.version}get instanceType(){return this.ternauth?.instanceType}get apiUrl(){return this.#s||""}async initTernSecureAuth(){if(this._mode!=="browser"&&this.isReady)return;const e=u.initialize(this.options);this.loadTernSecureAuth(e)}loadTernSecureAuth=e=>{if(!e)throw new Error("TernAuth instance is not initialized");return this.ternauth=e,this.preAddListener.forEach((t,r)=>{t.unsubscribe=e.addListener(r)}),this.#r.getListeners("status").forEach(t=>{this.on("status",t,{notify:!0})}),typeof this.ternauth.status>"u"&&(console.log("[IsoTernSecureAuth] TernSecureAuth has no status, setting internal status to ready"),this.#i="ready",this.#r.emit(a.Status,"ready")),this.ternauth};on=(...e)=>this.ternauth?.on?this.ternauth.on(...e):this.#r.on(...e);off=(...e)=>this.ternauth?.off?this.ternauth.off(...e):this.#r.off(...e);addListener=e=>{if(this.ternauth)return this.ternauth.addListener(e);{const t=()=>{const r=this.preAddListener.get(e);r&&(r.unsubscribe(),this.preAddListener.delete(e))};return this.preAddListener.set(e,{unsubscribe:t}),t}};createActiveSession=e=>this.ternauth?this.ternauth.createActiveSession(e):Promise.reject(new Error("TernSecureAuth not initialized"));signOut=async e=>{if(!this.ternauth)throw new Error("TernSecureAuth not initialized");await this.ternauth.signOut()};get currentSession(){return this.ternauth?this.ternauth.currentSession:null}onAuthStateChanged(e){return this.ternauth?this.ternauth.onAuthStateChanged(e):(console.warn("[IsoTernSecureAuth] TernAuth not initialized, cannot set up auth state listener"),()=>{})}getRedirectResult=async()=>{if(!this.ternauth?.getRedirectResult)throw new Error("TernSecure instance not initialized");return this.ternauth.getRedirectResult()};redirectToSignIn=async e=>{this.ternauth?.redirectToSignIn&&this.ternauth.redirectToSignIn(e)};redirectToSignUp=async e=>{this.ternauth?.redirectToSignUp&&this.ternauth.redirectToSignUp()};redirectAfterSignIn=e=>{this.ternauth?.redirectAfterSignIn&&this.ternauth.redirectAfterSignIn()};redirectAfterSignUp=e=>{this.ternauth?.redirectAfterSignUp&&this.ternauth.redirectAfterSignUp()};#u(){return new Promise(e=>{e(this.ternauth)})}initialize=async()=>{try{await this.#u()}catch(e){throw console.error("[IsomorphicTernSecure] Failed to initialize TernSecureAuth:",e),e}}}export{s as IsoTernSecureAuth,i as inBrowser};
1
+ import{TernSecureAuth as u}from"@tern-secure/auth";import{createTernAuthEventBus as o,ternEvents as a}from"@tern-secure/shared/ternStatusEvent";import{handleValueOrFn as n}from"@tern-secure/shared/utils";const h={name:"@tern-secure/react",version:"1.2.0-canary.v20251020032343",environment:process.env.NODE_ENV};function i(){return typeof window<"u"}class s{_mode;options;TernSecureAuth;ternauth=null;preAddListener=new Map;#i="loading";#s;#t;#n;#r=o();static#e;get status(){return this.ternauth?this.ternauth.status||(this.ternauth.isReady?"ready":"loading"):this.#i}get isReady(){return this.ternauth?.isReady||!1}get isLoading(){return this.ternauth?.isLoading||!1}get requiresVerification(){return this.options.requiresVerification??!0}get signIn(){if(this.ternauth)return this.ternauth.signIn}get signUp(){if(this.ternauth)return this.ternauth.signUp}get user(){if(this.ternauth)return this.ternauth.user}static getOrCreateInstance(e){return(!i()||!this.#e||e.TernSecureAuth&&this.#e.TernSecureAuth!==e.TernSecureAuth)&&(this.#e=new s(e)),this.#e}static clearInstances(){this.#e&&(this.#e.ternauth=null,this.#e=null)}static clearInstance(){this.#e=null}get domain(){if(typeof window<"u"&&window.location)return n(this.#t,new URL(window.location.href),"");if(typeof this.#t=="function")throw new Error("Unsupported customDomain type: function");return this.#t||""}get proxyUrl(){if(typeof window<"u"&&window.location)return n(this.#n,new URL(window.location.href),"");if(typeof this.#n=="function")throw new Error("Unsupported customProxyUrl type: function");return this.#n||""}get mode(){return this._mode}_internal_getOption(e){return this.ternauth?._internal_getOption?this.ternauth?._internal_getOption(e):this.options[e]}_internal_getAllOptions(){return Object.freeze({...this.options})}constructor(e){const{TernSecureAuth:t=null}=e||{};this.#t=e.ternSecureConfig?.authDomain,this.options={...e},this._mode=i()?"browser":"server",this.#s=this.options.apiUrl,this.TernSecureAuth=t,this.options.sdkMetadata||(this.options.sdkMetadata=h),this.initTernSecureAuth()}get sdkMetadata(){return this.ternauth?.sdkMetadata||this.options.sdkMetadata}get version(){return this.ternauth?.version}get instanceType(){return this.ternauth?.instanceType}get apiUrl(){return this.#s||""}async initTernSecureAuth(){if(this._mode!=="browser"&&this.isReady)return;const e=u.initialize(this.options);this.loadTernSecureAuth(e)}loadTernSecureAuth=e=>{if(!e)throw new Error("TernAuth instance is not initialized");return this.ternauth=e,this.preAddListener.forEach((t,r)=>{t.unsubscribe=e.addListener(r)}),this.#r.getListeners("status").forEach(t=>{this.on("status",t,{notify:!0})}),typeof this.ternauth.status>"u"&&(console.log("[IsoTernSecureAuth] TernSecureAuth has no status, setting internal status to ready"),this.#i="ready",this.#r.emit(a.Status,"ready")),this.ternauth};on=(...e)=>this.ternauth?.on?this.ternauth.on(...e):this.#r.on(...e);off=(...e)=>this.ternauth?.off?this.ternauth.off(...e):this.#r.off(...e);addListener=e=>{if(this.ternauth)return this.ternauth.addListener(e);{const t=()=>{const r=this.preAddListener.get(e);r&&(r.unsubscribe(),this.preAddListener.delete(e))};return this.preAddListener.set(e,{unsubscribe:t}),t}};createActiveSession=e=>this.ternauth?this.ternauth.createActiveSession(e):Promise.reject(new Error("TernSecureAuth not initialized"));signOut=async e=>{if(!this.ternauth)throw new Error("TernSecureAuth not initialized");await this.ternauth.signOut()};get currentSession(){return this.ternauth?this.ternauth.currentSession:null}onAuthStateChanged(e){return this.ternauth?this.ternauth.onAuthStateChanged(e):(console.warn("[IsoTernSecureAuth] TernAuth not initialized, cannot set up auth state listener"),()=>{})}getRedirectResult=async()=>{if(!this.ternauth?.getRedirectResult)throw new Error("TernSecure instance not initialized");return this.ternauth.getRedirectResult()};redirectToSignIn=async e=>{this.ternauth?.redirectToSignIn&&this.ternauth.redirectToSignIn(e)};redirectToSignUp=async e=>{this.ternauth?.redirectToSignUp&&this.ternauth.redirectToSignUp()};redirectAfterSignIn=e=>{this.ternauth?.redirectAfterSignIn&&this.ternauth.redirectAfterSignIn()};redirectAfterSignUp=e=>{this.ternauth?.redirectAfterSignUp&&this.ternauth.redirectAfterSignUp()};#u(){return new Promise(e=>{e(this.ternauth)})}initialize=async()=>{try{await this.#u()}catch(e){throw console.error("[IsomorphicTernSecure] Failed to initialize TernSecureAuth:",e),e}}}export{s as IsoTernSecureAuth,i as inBrowser};
2
2
  //# sourceMappingURL=isoTernSecureAuth.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tern-secure/react",
3
- "version": "1.2.0-canary.v20251019190011",
3
+ "version": "1.2.0-canary.v20251020032343",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/TernSecure/auth.git",
@@ -36,9 +36,9 @@
36
36
  "tailwind-merge": "^2.5.5",
37
37
  "tailwindcss-animate": "^1.0.7",
38
38
  "tslib": "2.4.1",
39
- "@tern-secure/auth": "1.1.0-canary.v20251019190011",
40
- "@tern-secure/shared": "1.3.0-canary.v20251019190011",
41
- "@tern-secure/types": "1.1.0-canary.v20251019190011"
39
+ "@tern-secure/auth": "1.1.0-canary.v20251020032343",
40
+ "@tern-secure/shared": "1.3.0-canary.v20251020032343",
41
+ "@tern-secure/types": "1.1.0-canary.v20251020032343"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@tailwindcss/cli": "^4.1.6",