@tern-secure/react 1.2.0-canary.v20251024005655 → 1.2.0-canary.v20251028151628

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.
@@ -0,0 +1,22 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode } from 'react';
4
+ import { SignUpProps, SignUpForceRedirectUrl, SignUpFallbackRedirectUrl, AuthErrorTree } from '@tern-secure/auth';
5
+
6
+ type SignUpCtx = SignUpProps & SignUpForceRedirectUrl & SignUpFallbackRedirectUrl;
7
+ type SignUpContextType = Omit<SignUpCtx, 'fallbackRedirectUrl' | 'forceRedirectUrl'> & {
8
+ handleSignUpError: (error: AuthErrorTree) => void;
9
+ redirectAfterSignUp: () => any;
10
+ signInUrl: string;
11
+ signUpUrl: string;
12
+ afterSignUpUrl: string;
13
+ afterSignInUrl: string;
14
+ };
15
+ declare const SignInContext: react.Context<SignUpCtx | null>;
16
+ declare const useSignUpContext: () => SignUpContextType;
17
+ interface SignUpProviderProps extends Partial<SignUpCtx> {
18
+ children: ReactNode;
19
+ }
20
+ declare function SignUpProvider({ children, ...ctxProps }: SignUpProviderProps): react_jsx_runtime.JSX.Element;
21
+
22
+ export { SignInContext, type SignUpContextType, type SignUpCtx, SignUpProvider, useSignUpContext };
@@ -0,0 +1,22 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode } from 'react';
4
+ import { SignUpProps, SignUpForceRedirectUrl, SignUpFallbackRedirectUrl, AuthErrorTree } from '@tern-secure/auth';
5
+
6
+ type SignUpCtx = SignUpProps & SignUpForceRedirectUrl & SignUpFallbackRedirectUrl;
7
+ type SignUpContextType = Omit<SignUpCtx, 'fallbackRedirectUrl' | 'forceRedirectUrl'> & {
8
+ handleSignUpError: (error: AuthErrorTree) => void;
9
+ redirectAfterSignUp: () => any;
10
+ signInUrl: string;
11
+ signUpUrl: string;
12
+ afterSignUpUrl: string;
13
+ afterSignInUrl: string;
14
+ };
15
+ declare const SignInContext: react.Context<SignUpCtx | null>;
16
+ declare const useSignUpContext: () => SignUpContextType;
17
+ interface SignUpProviderProps extends Partial<SignUpCtx> {
18
+ children: ReactNode;
19
+ }
20
+ declare function SignUpProvider({ children, ...ctxProps }: SignUpProviderProps): react_jsx_runtime.JSX.Element;
21
+
22
+ export { SignInContext, type SignUpContextType, type SignUpCtx, SignUpProvider, useSignUpContext };
@@ -0,0 +1,2 @@
1
+ "use strict";"use client";var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var I=(e,r)=>{for(var n in r)l(e,n,{get:r[n],enumerable:!0})},F=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of y(r))!E.call(e,t)&&t!==n&&l(e,t,{get:()=>r[t],enumerable:!(o=v(r,t))||o.enumerable});return e};var T=e=>F(l({},"__esModule",{value:!0}),e);var O={};I(O,{SignInContext:()=>p,SignUpProvider:()=>L,useSignUpContext:()=>k});module.exports=T(O);var d=require("react/jsx-runtime"),c=require("@tern-secure/auth"),S=require("@tern-secure/shared/react"),i=require("react");const p=(0,i.createContext)(null),k=()=>{const e=(0,i.useContext)(p),r=(0,S.useTernSecure)(),n=r._internal_getAllOptions(),o=(0,i.useMemo)(()=>typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,[]);if(e===null)throw new Error("useSignUpContext must be used within a SignUpProvider. Please wrap your component tree with SignUpProvider.");const{...t}=e,N=(0,i.useCallback)((U,C,b="AuthError",w)=>{const s=new Error(U);return s.name=b,s.code=C,s.response=w,s},[]),h=(0,i.useCallback)(U=>{console.error(U)},[]),a=new c.RedirectUrls(n,{...t,signUpForceRedirectUrl:t.signUpForceRedirectUrl||t.forceRedirectUrl,signUpFallbackRedirectUrl:t.signUpFallbackRedirectUrl||t.fallbackRedirectUrl},o),g=r.constructUrlWithAuthRedirect(a.getAfterSignUpUrl()),f=r.constructUrlWithAuthRedirect(a.getAfterSignInUrl()),m=()=>r.navigate(g),u=a.getPreservedSearchParams(),x=n.signUpUrl,P=n.signInUrl,R=(0,c.buildURL)({base:P,hashSearchParams:[o,u]},{stringify:!0}),A=(0,c.buildURL)({base:x,hashSearchParams:[o,u]},{stringify:!0});return{...t,afterSignInUrl:f,afterSignUpUrl:g,signInUrl:R,signUpUrl:A,handleSignUpError:h,redirectAfterSignUp:m}};function L({children:e,...r}){const n=r;return(0,d.jsx)(p.Provider,{value:n,children:e})}0&&(module.exports={SignInContext,SignUpProvider,useSignUpContext});
2
+ //# sourceMappingURL=SignUpCtx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ctx/SignUpCtx.tsx"],"sourcesContent":["'use client';\n\nimport type {\n AuthErrorTree,\n SignUpFallbackRedirectUrl,\n SignUpForceRedirectUrl,\n SignUpProps,\n} from '@tern-secure/auth';\nimport { buildURL, RedirectUrls } from '@tern-secure/auth';\nimport { useTernSecure } from '@tern-secure/shared/react';\nimport type { ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useMemo } from 'react';\n\nexport type SignUpCtx = SignUpProps & SignUpForceRedirectUrl & SignUpFallbackRedirectUrl;\n\nexport type SignUpContextType = Omit<SignUpCtx, 'fallbackRedirectUrl' | 'forceRedirectUrl'> & {\n handleSignUpError: (error: AuthErrorTree) => void;\n redirectAfterSignUp: () => any;\n signInUrl: string;\n signUpUrl: string;\n afterSignUpUrl: string;\n afterSignInUrl: string;\n};\n\nexport const SignInContext = createContext<SignUpCtx | null>(null);\n\nexport const useSignUpContext = (): SignUpContextType => {\n const context = useContext(SignInContext);\n const ternSecure = useTernSecure();\n const ternSecureOptions = ternSecure._internal_getAllOptions();\n const currentParams = useMemo(() => {\n if (typeof window !== 'undefined') {\n return new URLSearchParams(window.location.search);\n }\n return new URLSearchParams();\n }, []);\n\n if (context === null) {\n throw new Error(\n 'useSignUpContext must be used within a SignUpProvider. Please wrap your component tree with SignUpProvider.',\n );\n }\n\n const { ...ctx } = context;\n\n const createAuthError = useCallback(\n (message: string, code: string, name: string = 'AuthError', response?: any): AuthErrorTree => {\n const authError = new Error(message) as AuthErrorTree;\n authError.name = name;\n authError.code = code;\n authError.response = response;\n return authError;\n },\n [],\n );\n\n const handleSignUpError = useCallback((authError: AuthErrorTree) => {\n console.error(authError);\n }, []);\n\n const redirectUrls = new RedirectUrls(\n ternSecureOptions,\n {\n ...ctx,\n signUpForceRedirectUrl: ctx.signUpForceRedirectUrl || ctx.forceRedirectUrl,\n signUpFallbackRedirectUrl: ctx.signUpFallbackRedirectUrl || ctx.fallbackRedirectUrl,\n },\n currentParams,\n );\n\n const afterSignUpUrl = ternSecure.constructUrlWithAuthRedirect(redirectUrls.getAfterSignUpUrl());\n const afterSignInUrl = ternSecure.constructUrlWithAuthRedirect(redirectUrls.getAfterSignInUrl());\n\n const redirectAfterSignUp = () => ternSecure.navigate(afterSignUpUrl);\n\n const preservedParams = redirectUrls.getPreservedSearchParams();\n const baseSignUpUrl = ternSecureOptions.signUpUrl;\n const baseSignInUrl = ternSecureOptions.signInUrl;\n\n const signInUrl = buildURL(\n {\n base: baseSignInUrl,\n hashSearchParams: [currentParams, preservedParams],\n },\n { stringify: true },\n );\n\n const signUpUrl = buildURL(\n {\n base: baseSignUpUrl,\n hashSearchParams: [currentParams, preservedParams],\n },\n { stringify: true },\n );\n\n return {\n ...ctx,\n afterSignInUrl,\n afterSignUpUrl,\n signInUrl,\n signUpUrl,\n handleSignUpError,\n redirectAfterSignUp,\n };\n};\n\ninterface SignUpProviderProps extends Partial<SignUpCtx> {\n children: ReactNode;\n}\n\nexport function SignUpProvider({ children, ...ctxProps }: SignUpProviderProps) {\n const contextValue = ctxProps as SignUpCtx;\n return <SignInContext.Provider value={contextValue}>{children}</SignInContext.Provider>;\n}\n"],"mappings":"sbAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,mBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAL,GAgHS,IAAAM,EAAA,6BAxGTC,EAAuC,6BACvCC,EAA8B,qCAE9BA,EAAgE,iBAazD,MAAMN,KAAgB,iBAAgC,IAAI,EAEpDE,EAAmB,IAAyB,CACvD,MAAMK,KAAU,cAAWP,CAAa,EAClCQ,KAAa,iBAAc,EAC3BC,EAAoBD,EAAW,wBAAwB,EACvDE,KAAgB,WAAQ,IACxB,OAAO,OAAW,IACb,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAE5C,IAAI,gBACV,CAAC,CAAC,EAEL,GAAIH,IAAY,KACd,MAAM,IAAI,MACR,6GACF,EAGF,KAAM,CAAE,GAAGI,CAAI,EAAIJ,EAEbK,KAAkB,eACtB,CAACC,EAAiBC,EAAcC,EAAe,YAAaC,IAAkC,CAC5F,MAAMC,EAAY,IAAI,MAAMJ,CAAO,EACnC,OAAAI,EAAU,KAAOF,EACjBE,EAAU,KAAOH,EACjBG,EAAU,SAAWD,EACdC,CACT,EACA,CAAC,CACH,EAEMC,KAAoB,eAAaD,GAA6B,CAClE,QAAQ,MAAMA,CAAS,CACzB,EAAG,CAAC,CAAC,EAECE,EAAe,IAAI,eACvBV,EACA,CACE,GAAGE,EACH,uBAAwBA,EAAI,wBAA0BA,EAAI,iBAC1D,0BAA2BA,EAAI,2BAA6BA,EAAI,mBAClE,EACAD,CACF,EAEMU,EAAiBZ,EAAW,6BAA6BW,EAAa,kBAAkB,CAAC,EACzFE,EAAiBb,EAAW,6BAA6BW,EAAa,kBAAkB,CAAC,EAEzFG,EAAsB,IAAMd,EAAW,SAASY,CAAc,EAE9DG,EAAkBJ,EAAa,yBAAyB,EACxDK,EAAgBf,EAAkB,UAClCgB,EAAgBhB,EAAkB,UAElCiB,KAAY,YAChB,CACE,KAAMD,EACN,iBAAkB,CAACf,EAAea,CAAe,CACnD,EACA,CAAE,UAAW,EAAK,CACpB,EAEMI,KAAY,YAChB,CACE,KAAMH,EACN,iBAAkB,CAACd,EAAea,CAAe,CACnD,EACA,CAAE,UAAW,EAAK,CACpB,EAEA,MAAO,CACL,GAAGZ,EACH,eAAAU,EACA,eAAAD,EACA,UAAAM,EACA,UAAAC,EACA,kBAAAT,EACA,oBAAAI,CACF,CACF,EAMO,SAASrB,EAAe,CAAE,SAAA2B,EAAU,GAAGC,CAAS,EAAwB,CAC7E,MAAMC,EAAeD,EACrB,SAAO,OAAC7B,EAAc,SAAd,CAAuB,MAAO8B,EAAe,SAAAF,EAAS,CAChE","names":["SignUpCtx_exports","__export","SignInContext","SignUpProvider","useSignUpContext","__toCommonJS","import_jsx_runtime","import_auth","import_react","context","ternSecure","ternSecureOptions","currentParams","ctx","createAuthError","message","code","name","response","authError","handleSignUpError","redirectUrls","afterSignUpUrl","afterSignInUrl","redirectAfterSignUp","preservedParams","baseSignUpUrl","baseSignInUrl","signInUrl","signUpUrl","children","ctxProps","contextValue"]}
@@ -0,0 +1,2 @@
1
+ "use client";import{jsx as E}from"react/jsx-runtime";import{buildURL as l,RedirectUrls as C}from"@tern-secure/auth";import{useTernSecure as b}from"@tern-secure/shared/react";import{createContext as w,useCallback as p,useContext as v,useMemo as y}from"react";const g=w(null),L=()=>{const n=v(g),r=b(),t=r._internal_getAllOptions(),o=y(()=>typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,[]);if(n===null)throw new Error("useSignUpContext must be used within a SignUpProvider. Please wrap your component tree with SignUpProvider.");const{...e}=n,I=p((s,P,R="AuthError",A)=>{const i=new Error(s);return i.name=R,i.code=P,i.response=A,i},[]),u=p(s=>{console.error(s)},[]),c=new C(t,{...e,signUpForceRedirectUrl:e.signUpForceRedirectUrl||e.forceRedirectUrl,signUpFallbackRedirectUrl:e.signUpFallbackRedirectUrl||e.fallbackRedirectUrl},o),a=r.constructUrlWithAuthRedirect(c.getAfterSignUpUrl()),S=r.constructUrlWithAuthRedirect(c.getAfterSignInUrl()),d=()=>r.navigate(a),U=c.getPreservedSearchParams(),h=t.signUpUrl,f=t.signInUrl,m=l({base:f,hashSearchParams:[o,U]},{stringify:!0}),x=l({base:h,hashSearchParams:[o,U]},{stringify:!0});return{...e,afterSignInUrl:S,afterSignUpUrl:a,signInUrl:m,signUpUrl:x,handleSignUpError:u,redirectAfterSignUp:d}};function O({children:n,...r}){const t=r;return E(g.Provider,{value:t,children:n})}export{g as SignInContext,O as SignUpProvider,L as useSignUpContext};
2
+ //# sourceMappingURL=SignUpCtx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ctx/SignUpCtx.tsx"],"sourcesContent":["'use client';\n\nimport type {\n AuthErrorTree,\n SignUpFallbackRedirectUrl,\n SignUpForceRedirectUrl,\n SignUpProps,\n} from '@tern-secure/auth';\nimport { buildURL, RedirectUrls } from '@tern-secure/auth';\nimport { useTernSecure } from '@tern-secure/shared/react';\nimport type { ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useMemo } from 'react';\n\nexport type SignUpCtx = SignUpProps & SignUpForceRedirectUrl & SignUpFallbackRedirectUrl;\n\nexport type SignUpContextType = Omit<SignUpCtx, 'fallbackRedirectUrl' | 'forceRedirectUrl'> & {\n handleSignUpError: (error: AuthErrorTree) => void;\n redirectAfterSignUp: () => any;\n signInUrl: string;\n signUpUrl: string;\n afterSignUpUrl: string;\n afterSignInUrl: string;\n};\n\nexport const SignInContext = createContext<SignUpCtx | null>(null);\n\nexport const useSignUpContext = (): SignUpContextType => {\n const context = useContext(SignInContext);\n const ternSecure = useTernSecure();\n const ternSecureOptions = ternSecure._internal_getAllOptions();\n const currentParams = useMemo(() => {\n if (typeof window !== 'undefined') {\n return new URLSearchParams(window.location.search);\n }\n return new URLSearchParams();\n }, []);\n\n if (context === null) {\n throw new Error(\n 'useSignUpContext must be used within a SignUpProvider. Please wrap your component tree with SignUpProvider.',\n );\n }\n\n const { ...ctx } = context;\n\n const createAuthError = useCallback(\n (message: string, code: string, name: string = 'AuthError', response?: any): AuthErrorTree => {\n const authError = new Error(message) as AuthErrorTree;\n authError.name = name;\n authError.code = code;\n authError.response = response;\n return authError;\n },\n [],\n );\n\n const handleSignUpError = useCallback((authError: AuthErrorTree) => {\n console.error(authError);\n }, []);\n\n const redirectUrls = new RedirectUrls(\n ternSecureOptions,\n {\n ...ctx,\n signUpForceRedirectUrl: ctx.signUpForceRedirectUrl || ctx.forceRedirectUrl,\n signUpFallbackRedirectUrl: ctx.signUpFallbackRedirectUrl || ctx.fallbackRedirectUrl,\n },\n currentParams,\n );\n\n const afterSignUpUrl = ternSecure.constructUrlWithAuthRedirect(redirectUrls.getAfterSignUpUrl());\n const afterSignInUrl = ternSecure.constructUrlWithAuthRedirect(redirectUrls.getAfterSignInUrl());\n\n const redirectAfterSignUp = () => ternSecure.navigate(afterSignUpUrl);\n\n const preservedParams = redirectUrls.getPreservedSearchParams();\n const baseSignUpUrl = ternSecureOptions.signUpUrl;\n const baseSignInUrl = ternSecureOptions.signInUrl;\n\n const signInUrl = buildURL(\n {\n base: baseSignInUrl,\n hashSearchParams: [currentParams, preservedParams],\n },\n { stringify: true },\n );\n\n const signUpUrl = buildURL(\n {\n base: baseSignUpUrl,\n hashSearchParams: [currentParams, preservedParams],\n },\n { stringify: true },\n );\n\n return {\n ...ctx,\n afterSignInUrl,\n afterSignUpUrl,\n signInUrl,\n signUpUrl,\n handleSignUpError,\n redirectAfterSignUp,\n };\n};\n\ninterface SignUpProviderProps extends Partial<SignUpCtx> {\n children: ReactNode;\n}\n\nexport function SignUpProvider({ children, ...ctxProps }: SignUpProviderProps) {\n const contextValue = ctxProps as SignUpCtx;\n return <SignInContext.Provider value={contextValue}>{children}</SignInContext.Provider>;\n}\n"],"mappings":"aAgHS,cAAAA,MAAA,oBAxGT,OAAS,YAAAC,EAAU,gBAAAC,MAAoB,oBACvC,OAAS,iBAAAC,MAAqB,4BAE9B,OAAS,iBAAAC,EAAe,eAAAC,EAAa,cAAAC,EAAY,WAAAC,MAAe,QAazD,MAAMC,EAAgBJ,EAAgC,IAAI,EAEpDK,EAAmB,IAAyB,CACvD,MAAMC,EAAUJ,EAAWE,CAAa,EAClCG,EAAaR,EAAc,EAC3BS,EAAoBD,EAAW,wBAAwB,EACvDE,EAAgBN,EAAQ,IACxB,OAAO,OAAW,IACb,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAE5C,IAAI,gBACV,CAAC,CAAC,EAEL,GAAIG,IAAY,KACd,MAAM,IAAI,MACR,6GACF,EAGF,KAAM,CAAE,GAAGI,CAAI,EAAIJ,EAEbK,EAAkBV,EACtB,CAACW,EAAiBC,EAAcC,EAAe,YAAaC,IAAkC,CAC5F,MAAMC,EAAY,IAAI,MAAMJ,CAAO,EACnC,OAAAI,EAAU,KAAOF,EACjBE,EAAU,KAAOH,EACjBG,EAAU,SAAWD,EACdC,CACT,EACA,CAAC,CACH,EAEMC,EAAoBhB,EAAae,GAA6B,CAClE,QAAQ,MAAMA,CAAS,CACzB,EAAG,CAAC,CAAC,EAECE,EAAe,IAAIpB,EACvBU,EACA,CACE,GAAGE,EACH,uBAAwBA,EAAI,wBAA0BA,EAAI,iBAC1D,0BAA2BA,EAAI,2BAA6BA,EAAI,mBAClE,EACAD,CACF,EAEMU,EAAiBZ,EAAW,6BAA6BW,EAAa,kBAAkB,CAAC,EACzFE,EAAiBb,EAAW,6BAA6BW,EAAa,kBAAkB,CAAC,EAEzFG,EAAsB,IAAMd,EAAW,SAASY,CAAc,EAE9DG,EAAkBJ,EAAa,yBAAyB,EACxDK,EAAgBf,EAAkB,UAClCgB,EAAgBhB,EAAkB,UAElCiB,EAAY5B,EAChB,CACE,KAAM2B,EACN,iBAAkB,CAACf,EAAea,CAAe,CACnD,EACA,CAAE,UAAW,EAAK,CACpB,EAEMI,EAAY7B,EAChB,CACE,KAAM0B,EACN,iBAAkB,CAACd,EAAea,CAAe,CACnD,EACA,CAAE,UAAW,EAAK,CACpB,EAEA,MAAO,CACL,GAAGZ,EACH,eAAAU,EACA,eAAAD,EACA,UAAAM,EACA,UAAAC,EACA,kBAAAT,EACA,oBAAAI,CACF,CACF,EAMO,SAASM,EAAe,CAAE,SAAAC,EAAU,GAAGC,CAAS,EAAwB,CAC7E,MAAMC,EAAeD,EACrB,OAAOjC,EAACQ,EAAc,SAAd,CAAuB,MAAO0B,EAAe,SAAAF,EAAS,CAChE","names":["jsx","buildURL","RedirectUrls","useTernSecure","createContext","useCallback","useContext","useMemo","SignInContext","useSignUpContext","context","ternSecure","ternSecureOptions","currentParams","ctx","createAuthError","message","code","name","response","authError","handleSignUpError","redirectUrls","afterSignUpUrl","afterSignInUrl","redirectAfterSignUp","preservedParams","baseSignUpUrl","baseSignInUrl","signInUrl","signUpUrl","SignUpProvider","children","ctxProps","contextValue"]}
@@ -0,0 +1,5 @@
1
+ import { UseSignUpReturn } from '@tern-secure/types';
2
+
3
+ declare const useSignUp: () => UseSignUpReturn;
4
+
5
+ export { useSignUp };
@@ -0,0 +1,5 @@
1
+ import { UseSignUpReturn } from '@tern-secure/types';
2
+
3
+ declare const useSignUp: () => UseSignUpReturn;
4
+
5
+ export { useSignUp };
@@ -0,0 +1,2 @@
1
+ "use strict";var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:!0})},f=(e,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of U(r))!d.call(e,t)&&t!==n&&s(e,t,{get:()=>r[t],enumerable:!(i=o(r,t))||i.enumerable});return e};var m=e=>f(s({},"__esModule",{value:!0}),e);var a={};g(a,{useSignUp:()=>S});module.exports=m(a);var p=require("../ctx/TernSecureAuthResourcesCtx"),u=require("./useAssertWrappedTernSecureProvider");const S=()=>{(0,u.useAssertWrappedByTernSecureAuthProvider)("useSignUp");const e=(0,p.useAuthSignUpCtx)();return e?{isLoaded:!0,signUp:e}:{isLoaded:!1,signUp:void 0}};0&&(module.exports={useSignUp});
2
+ //# sourceMappingURL=useSignUp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/hooks/useSignUp.ts"],"sourcesContent":["import type { UseSignUpReturn } from '@tern-secure/types';\n\nimport { useAuthSignUpCtx } from '../ctx/TernSecureAuthResourcesCtx';\nimport { useAssertWrappedByTernSecureAuthProvider } from './useAssertWrappedTernSecureProvider';\n\nexport const useSignUp = (): UseSignUpReturn => {\n useAssertWrappedByTernSecureAuthProvider('useSignUp');\n const auth = useAuthSignUpCtx();\n\n if (!auth) {\n return {\n isLoaded: false,\n signUp: undefined,\n };\n }\n\n return {\n isLoaded: true,\n signUp: auth,\n };\n};\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAiC,6CACjCC,EAAyD,gDAElD,MAAMH,EAAY,IAAuB,IAC9C,4CAAyC,WAAW,EACpD,MAAMI,KAAO,oBAAiB,EAE9B,OAAKA,EAOE,CACL,SAAU,GACV,OAAQA,CACV,EATS,CACL,SAAU,GACV,OAAQ,MACV,CAOJ","names":["useSignUp_exports","__export","useSignUp","__toCommonJS","import_TernSecureAuthResourcesCtx","import_useAssertWrappedTernSecureProvider","auth"]}
@@ -0,0 +1,2 @@
1
+ import{useAuthSignUpCtx as r}from"../ctx/TernSecureAuthResourcesCtx";import{useAssertWrappedByTernSecureAuthProvider as t}from"./useAssertWrappedTernSecureProvider";const i=()=>{t("useSignUp");const e=r();return e?{isLoaded:!0,signUp:e}:{isLoaded:!1,signUp:void 0}};export{i as useSignUp};
2
+ //# sourceMappingURL=useSignUp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/hooks/useSignUp.ts"],"sourcesContent":["import type { UseSignUpReturn } from '@tern-secure/types';\n\nimport { useAuthSignUpCtx } from '../ctx/TernSecureAuthResourcesCtx';\nimport { useAssertWrappedByTernSecureAuthProvider } from './useAssertWrappedTernSecureProvider';\n\nexport const useSignUp = (): UseSignUpReturn => {\n useAssertWrappedByTernSecureAuthProvider('useSignUp');\n const auth = useAuthSignUpCtx();\n\n if (!auth) {\n return {\n isLoaded: false,\n signUp: undefined,\n };\n }\n\n return {\n isLoaded: true,\n signUp: auth,\n };\n};\n"],"mappings":"AAEA,OAAS,oBAAAA,MAAwB,oCACjC,OAAS,4CAAAC,MAAgD,uCAElD,MAAMC,EAAY,IAAuB,CAC9CD,EAAyC,WAAW,EACpD,MAAME,EAAOH,EAAiB,EAE9B,OAAKG,EAOE,CACL,SAAU,GACV,OAAQA,CACV,EATS,CACL,SAAU,GACV,OAAQ,MACV,CAOJ","names":["useAuthSignUpCtx","useAssertWrappedByTernSecureAuthProvider","useSignUp","auth"]}
package/dist/index.d.mts CHANGED
@@ -2,9 +2,11 @@ export { useAuth, useDeriveAuth } from './hooks/useAuth.mjs';
2
2
  export { useIdToken } from './hooks/useIdToken.mjs';
3
3
  export { useSession } from './hooks/useSession.mjs';
4
4
  export { signIn, useSignIn } from './hooks/useSignIn.mjs';
5
+ export { useSignUp } from './hooks/useSignUp.mjs';
5
6
  export { TernSecureCtxProvider } from './ctx/TernSecureCtxProvider.mjs';
6
7
  export { TernSecureProvider } from './ctx/TernSecureProvider.mjs';
7
8
  export { SignInProvider, useSignInContext } from './ctx/SignInCtx.mjs';
9
+ export { SignUpProvider, useSignUpContext } from './ctx/SignUpCtx.mjs';
8
10
  export { handleInternalRoute, isAuthRoute, isBaseAuthRoute, isInternalRoute } from './route-handler/internal-route.mjs';
9
11
  export { cn } from './lib/utils.mjs';
10
12
  export { Browser, IsoTernSecureAuthOptions, IsomorphicTernSecureOptions, TernSecureProviderProps } from './types.mjs';
package/dist/index.d.ts CHANGED
@@ -2,9 +2,11 @@ export { useAuth, useDeriveAuth } from './hooks/useAuth.js';
2
2
  export { useIdToken } from './hooks/useIdToken.js';
3
3
  export { useSession } from './hooks/useSession.js';
4
4
  export { signIn, useSignIn } from './hooks/useSignIn.js';
5
+ export { useSignUp } from './hooks/useSignUp.js';
5
6
  export { TernSecureCtxProvider } from './ctx/TernSecureCtxProvider.js';
6
7
  export { TernSecureProvider } from './ctx/TernSecureProvider.js';
7
8
  export { SignInProvider, useSignInContext } from './ctx/SignInCtx.js';
9
+ export { SignUpProvider, useSignUpContext } from './ctx/SignUpCtx.js';
8
10
  export { handleInternalRoute, isAuthRoute, isBaseAuthRoute, isInternalRoute } from './route-handler/internal-route.js';
9
11
  export { cn } from './lib/utils.js';
10
12
  export { Browser, IsoTernSecureAuthOptions, IsomorphicTernSecureOptions, TernSecureProviderProps } from './types.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var v=(o,e)=>{for(var u in e)p(o,u,{get:e[u],enumerable:!0})},A=(o,e,u,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!d.call(o,n)&&n!==u&&p(o,n,{get:()=>e[n],enumerable:!(x=h(e,n))||x.enumerable});return o};var P=o=>A(p({},"__esModule",{value:!0}),o);var a={};v(a,{SignInProvider:()=>t.SignInProvider,TernSecureCtxProvider:()=>S.TernSecureCtxProvider,TernSecureProvider:()=>I.TernSecureProvider,cn:()=>c.cn,handleInternalRoute:()=>r.handleInternalRoute,isAuthRoute:()=>r.isAuthRoute,isBaseAuthRoute:()=>r.isBaseAuthRoute,isInternalRoute:()=>r.isInternalRoute,signIn:()=>i.signIn,useAuth:()=>s.useAuth,useDeriveAuth:()=>s.useDeriveAuth,useIdToken:()=>m.useIdToken,useSession:()=>f.useSession,useSignIn:()=>i.useSignIn,useSignInContext:()=>t.useSignInContext,useTernSecure:()=>t.useTernSecure});module.exports=P(a);var s=require("./hooks/useAuth"),m=require("./hooks/useIdToken"),f=require("./hooks/useSession"),i=require("./hooks/useSignIn"),S=require("./ctx/TernSecureCtxProvider"),I=require("./ctx/TernSecureProvider"),t=require("./ctx/SignInCtx"),r=require("./route-handler/internal-route"),c=require("./lib/utils");0&&(module.exports={SignInProvider,TernSecureCtxProvider,TernSecureProvider,cn,handleInternalRoute,isAuthRoute,isBaseAuthRoute,isInternalRoute,signIn,useAuth,useDeriveAuth,useIdToken,useSession,useSignIn,useSignInContext,useTernSecure});
1
+ "use strict";var x=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var P=(o,e)=>{for(var u in e)x(o,u,{get:e[u],enumerable:!0})},A=(o,e,u,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!v.call(o,n)&&n!==u&&x(o,n,{get:()=>e[n],enumerable:!(m=h(e,n))||m.enumerable});return o};var a=o=>A(x({},"__esModule",{value:!0}),o);var R={};P(R,{SignInProvider:()=>t.SignInProvider,SignUpProvider:()=>i.SignUpProvider,TernSecureCtxProvider:()=>c.TernSecureCtxProvider,TernSecureProvider:()=>d.TernSecureProvider,cn:()=>g.cn,handleInternalRoute:()=>r.handleInternalRoute,isAuthRoute:()=>r.isAuthRoute,isBaseAuthRoute:()=>r.isBaseAuthRoute,isInternalRoute:()=>r.isInternalRoute,signIn:()=>p.signIn,useAuth:()=>s.useAuth,useDeriveAuth:()=>s.useDeriveAuth,useIdToken:()=>S.useIdToken,useSession:()=>f.useSession,useSignIn:()=>p.useSignIn,useSignInContext:()=>t.useSignInContext,useSignUp:()=>I.useSignUp,useSignUpContext:()=>i.useSignUpContext,useTernSecure:()=>t.useTernSecure});module.exports=a(R);var s=require("./hooks/useAuth"),S=require("./hooks/useIdToken"),f=require("./hooks/useSession"),p=require("./hooks/useSignIn"),I=require("./hooks/useSignUp"),c=require("./ctx/TernSecureCtxProvider"),d=require("./ctx/TernSecureProvider"),t=require("./ctx/SignInCtx"),i=require("./ctx/SignUpCtx"),r=require("./route-handler/internal-route"),g=require("./lib/utils");0&&(module.exports={SignInProvider,SignUpProvider,TernSecureCtxProvider,TernSecureProvider,cn,handleInternalRoute,isAuthRoute,isBaseAuthRoute,isInternalRoute,signIn,useAuth,useDeriveAuth,useIdToken,useSession,useSignIn,useSignInContext,useSignUp,useSignUpContext,useTernSecure});
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { useAuth, useDeriveAuth} from './hooks/useAuth';\nexport { useIdToken } from './hooks/useIdToken';\nexport { useSession } from './hooks/useSession';\nexport { useSignIn, signIn } from './hooks/useSignIn';\nexport { TernSecureCtxProvider } from './ctx/TernSecureCtxProvider';\nexport { TernSecureProvider } from './ctx/TernSecureProvider';\nexport { useSignInContext, SignInProvider, useTernSecure } from './ctx/SignInCtx';\n\nexport {\n isAuthRoute,\n isBaseAuthRoute,\n isInternalRoute,\n handleInternalRoute,\n} from './route-handler/internal-route';\n\nexport { cn } from './lib/utils';\n\nexport type {\n IsomorphicTernSecureOptions,\n IsoTernSecureAuthOptions,\n Browser,\n TernSecureProviderProps,\n} from './types';\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,giBAAAE,EAAAF,GAAA,IAAAG,EAAsC,2BACtCC,EAA2B,8BAC3BC,EAA2B,8BAC3BC,EAAkC,6BAClCC,EAAsC,uCACtCC,EAAmC,oCACnCC,EAAgE,2BAEhEC,EAKO,0CAEPC,EAAmB","names":["index_exports","__export","__toCommonJS","import_useAuth","import_useIdToken","import_useSession","import_useSignIn","import_TernSecureCtxProvider","import_TernSecureProvider","import_SignInCtx","import_internal_route","import_utils"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { useAuth, useDeriveAuth} from './hooks/useAuth';\nexport { useIdToken } from './hooks/useIdToken';\nexport { useSession } from './hooks/useSession';\nexport { useSignIn, signIn } from './hooks/useSignIn';\nexport { useSignUp } from './hooks/useSignUp';\nexport { TernSecureCtxProvider } from './ctx/TernSecureCtxProvider';\nexport { TernSecureProvider } from './ctx/TernSecureProvider';\nexport { useSignInContext, SignInProvider, useTernSecure } from './ctx/SignInCtx';\nexport { useSignUpContext, SignUpProvider } from './ctx/SignUpCtx';\n\nexport {\n isAuthRoute,\n isBaseAuthRoute,\n isInternalRoute,\n handleInternalRoute,\n} from './route-handler/internal-route';\n\nexport { cn } from './lib/utils';\n\nexport type {\n IsomorphicTernSecureOptions,\n IsoTernSecureAuthOptions,\n Browser,\n TernSecureProviderProps,\n} from './types';\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,soBAAAE,EAAAF,GAAA,IAAAG,EAAsC,2BACtCC,EAA2B,8BAC3BC,EAA2B,8BAC3BC,EAAkC,6BAClCC,EAA0B,6BAC1BC,EAAsC,uCACtCC,EAAmC,oCACnCC,EAAgE,2BAChEC,EAAiD,2BAEjDC,EAKO,0CAEPC,EAAmB","names":["index_exports","__export","__toCommonJS","import_useAuth","import_useIdToken","import_useSession","import_useSignIn","import_useSignUp","import_TernSecureCtxProvider","import_TernSecureProvider","import_SignInCtx","import_SignUpCtx","import_internal_route","import_utils"]}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{useAuth as o,useDeriveAuth as t}from"./hooks/useAuth";import{useIdToken as u}from"./hooks/useIdToken";import{useSession as i}from"./hooks/useSession";import{useSignIn as x,signIn as m}from"./hooks/useSignIn";import{TernSecureCtxProvider as S}from"./ctx/TernSecureCtxProvider";import{TernSecureProvider as c}from"./ctx/TernSecureProvider";import{useSignInContext as T,SignInProvider as d,useTernSecure as v}from"./ctx/SignInCtx";import{isAuthRoute as P,isBaseAuthRoute as a,isInternalRoute as g,handleInternalRoute as R}from"./route-handler/internal-route";import{cn as y}from"./lib/utils";export{d as SignInProvider,S as TernSecureCtxProvider,c as TernSecureProvider,y as cn,R as handleInternalRoute,P as isAuthRoute,a as isBaseAuthRoute,g as isInternalRoute,m as signIn,o as useAuth,t as useDeriveAuth,u as useIdToken,i as useSession,x as useSignIn,T as useSignInContext,v as useTernSecure};
1
+ import{useAuth as o,useDeriveAuth as t}from"./hooks/useAuth";import{useIdToken as u}from"./hooks/useIdToken";import{useSession as p}from"./hooks/useSession";import{useSignIn as x,signIn as m}from"./hooks/useSignIn";import{useSignUp as f}from"./hooks/useSignUp";import{TernSecureCtxProvider as c}from"./ctx/TernSecureCtxProvider";import{TernSecureProvider as g}from"./ctx/TernSecureProvider";import{useSignInContext as T,SignInProvider as v,useTernSecure as P}from"./ctx/SignInCtx";import{useSignUpContext as a,SignUpProvider as R}from"./ctx/SignUpCtx";import{isAuthRoute as C,isBaseAuthRoute as U,isInternalRoute as y,handleInternalRoute as B}from"./route-handler/internal-route";import{cn as k}from"./lib/utils";export{v as SignInProvider,R as SignUpProvider,c as TernSecureCtxProvider,g as TernSecureProvider,k as cn,B as handleInternalRoute,C as isAuthRoute,U as isBaseAuthRoute,y as isInternalRoute,m as signIn,o as useAuth,t as useDeriveAuth,u as useIdToken,p as useSession,x as useSignIn,T as useSignInContext,f as useSignUp,a as useSignUpContext,P as useTernSecure};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { useAuth, useDeriveAuth} from './hooks/useAuth';\nexport { useIdToken } from './hooks/useIdToken';\nexport { useSession } from './hooks/useSession';\nexport { useSignIn, signIn } from './hooks/useSignIn';\nexport { TernSecureCtxProvider } from './ctx/TernSecureCtxProvider';\nexport { TernSecureProvider } from './ctx/TernSecureProvider';\nexport { useSignInContext, SignInProvider, useTernSecure } from './ctx/SignInCtx';\n\nexport {\n isAuthRoute,\n isBaseAuthRoute,\n isInternalRoute,\n handleInternalRoute,\n} from './route-handler/internal-route';\n\nexport { cn } from './lib/utils';\n\nexport type {\n IsomorphicTernSecureOptions,\n IsoTernSecureAuthOptions,\n Browser,\n TernSecureProviderProps,\n} from './types';\n"],"mappings":"AAAA,OAAS,WAAAA,EAAS,iBAAAC,MAAoB,kBACtC,OAAS,cAAAC,MAAkB,qBAC3B,OAAS,cAAAC,MAAkB,qBAC3B,OAAS,aAAAC,EAAW,UAAAC,MAAc,oBAClC,OAAS,yBAAAC,MAA6B,8BACtC,OAAS,sBAAAC,MAA0B,2BACnC,OAAS,oBAAAC,EAAkB,kBAAAC,EAAgB,iBAAAC,MAAqB,kBAEhE,OACE,eAAAC,EACA,mBAAAC,EACA,mBAAAC,EACA,uBAAAC,MACK,iCAEP,OAAS,MAAAC,MAAU","names":["useAuth","useDeriveAuth","useIdToken","useSession","useSignIn","signIn","TernSecureCtxProvider","TernSecureProvider","useSignInContext","SignInProvider","useTernSecure","isAuthRoute","isBaseAuthRoute","isInternalRoute","handleInternalRoute","cn"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { useAuth, useDeriveAuth} from './hooks/useAuth';\nexport { useIdToken } from './hooks/useIdToken';\nexport { useSession } from './hooks/useSession';\nexport { useSignIn, signIn } from './hooks/useSignIn';\nexport { useSignUp } from './hooks/useSignUp';\nexport { TernSecureCtxProvider } from './ctx/TernSecureCtxProvider';\nexport { TernSecureProvider } from './ctx/TernSecureProvider';\nexport { useSignInContext, SignInProvider, useTernSecure } from './ctx/SignInCtx';\nexport { useSignUpContext, SignUpProvider } from './ctx/SignUpCtx';\n\nexport {\n isAuthRoute,\n isBaseAuthRoute,\n isInternalRoute,\n handleInternalRoute,\n} from './route-handler/internal-route';\n\nexport { cn } from './lib/utils';\n\nexport type {\n IsomorphicTernSecureOptions,\n IsoTernSecureAuthOptions,\n Browser,\n TernSecureProviderProps,\n} from './types';\n"],"mappings":"AAAA,OAAS,WAAAA,EAAS,iBAAAC,MAAoB,kBACtC,OAAS,cAAAC,MAAkB,qBAC3B,OAAS,cAAAC,MAAkB,qBAC3B,OAAS,aAAAC,EAAW,UAAAC,MAAc,oBAClC,OAAS,aAAAC,MAAiB,oBAC1B,OAAS,yBAAAC,MAA6B,8BACtC,OAAS,sBAAAC,MAA0B,2BACnC,OAAS,oBAAAC,EAAkB,kBAAAC,EAAgB,iBAAAC,MAAqB,kBAChE,OAAS,oBAAAC,EAAkB,kBAAAC,MAAsB,kBAEjD,OACE,eAAAC,EACA,mBAAAC,EACA,mBAAAC,EACA,uBAAAC,MACK,iCAEP,OAAS,MAAAC,MAAU","names":["useAuth","useDeriveAuth","useIdToken","useSession","useSignIn","signIn","useSignUp","TernSecureCtxProvider","TernSecureProvider","useSignInContext","SignInProvider","useTernSecure","useSignUpContext","SignUpProvider","isAuthRoute","isBaseAuthRoute","isInternalRoute","handleInternalRoute","cn"]}
@@ -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 f=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},S=(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 g=r=>S(u({},"__esModule",{value:!0}),r);var T={};f(T,{IsoTernSecureAuth:()=>h,inBrowser:()=>a});module.exports=g(T);var c=require("@tern-secure/auth"),s=require("@tern-secure/shared/ternStatusEvent"),o=require("@tern-secure/shared/utils");const A={name:"@tern-secure/react",version:"1.2.0-canary.v20251024005655",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||void 0}get signUp(){if(this.ternauth)return this.ternauth.signUp||void 0}get user(){return this.ternauth?this.ternauth.user:null}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=A)}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||""}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()};constructUrlWithAuthRedirect=e=>this.ternauth&&this.isReady?this.ternauth.constructUrlWithAuthRedirect(e):"";navigate=e=>{this.ternauth&&this.isReady&&this.ternauth.navigate(e)};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()=>{this.initTernSecureAuth();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 f=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},S=(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 g=r=>S(u({},"__esModule",{value:!0}),r);var T={};f(T,{IsoTernSecureAuth:()=>h,inBrowser:()=>a});module.exports=g(T);var c=require("@tern-secure/auth"),s=require("@tern-secure/shared/ternStatusEvent"),o=require("@tern-secure/shared/utils");const A={name:"@tern-secure/react",version:"1.2.0-canary.v20251028151628",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||void 0}get signUp(){if(this.ternauth)return this.ternauth.signUp||void 0}get user(){return this.ternauth?this.ternauth.user:null}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=A)}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||""}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()};constructUrlWithAuthRedirect=e=>this.ternauth&&this.isReady?this.ternauth.constructUrlWithAuthRedirect(e):"";navigate=e=>{this.ternauth&&this.isReady&&this.ternauth.navigate(e)};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()=>{this.initTernSecureAuth();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.v20251024005655",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||void 0}get signUp(){if(this.ternauth)return this.ternauth.signUp||void 0}get user(){return this.ternauth?this.ternauth.user:null}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)}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||""}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()};constructUrlWithAuthRedirect=e=>this.ternauth&&this.isReady?this.ternauth.constructUrlWithAuthRedirect(e):"";navigate=e=>{this.ternauth&&this.isReady&&this.ternauth.navigate(e)};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()=>{this.initTernSecureAuth();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.v20251028151628",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||void 0}get signUp(){if(this.ternauth)return this.ternauth.signUp||void 0}get user(){return this.ternauth?this.ternauth.user:null}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)}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||""}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()};constructUrlWithAuthRedirect=e=>this.ternauth&&this.isReady?this.ternauth.constructUrlWithAuthRedirect(e):"";navigate=e=>{this.ternauth&&this.isReady&&this.ternauth.navigate(e)};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()=>{this.initTernSecureAuth();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.v20251024005655",
3
+ "version": "1.2.0-canary.v20251028151628",
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.v20251024005655",
40
- "@tern-secure/shared": "1.3.0-canary.v20251024005655",
41
- "@tern-secure/types": "1.1.0-canary.v20251024005655"
39
+ "@tern-secure/auth": "1.1.0-canary.v20251028151628",
40
+ "@tern-secure/shared": "1.3.0-canary.v20251028151628",
41
+ "@tern-secure/types": "1.1.0-canary.v20251028151628"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@tailwindcss/cli": "^4.1.6",