@tern-secure/react 1.1.5 → 1.1.6
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.
- package/dist/ctx/AuthProvider.d.mts +13 -3
- package/dist/ctx/AuthProvider.d.ts +13 -3
- package/dist/ctx/AuthProvider.js +1 -1
- package/dist/ctx/AuthProvider.js.map +1 -1
- package/dist/ctx/AuthProvider.mjs +1 -1
- package/dist/ctx/AuthProvider.mjs.map +1 -1
- package/dist/ctx/IsomorphicTernSecureCtx.d.mts +5 -5
- package/dist/ctx/IsomorphicTernSecureCtx.d.ts +5 -5
- package/dist/ctx/IsomorphicTernSecureCtx.js +1 -1
- package/dist/ctx/IsomorphicTernSecureCtx.js.map +1 -1
- package/dist/ctx/IsomorphicTernSecureCtx.mjs +1 -1
- package/dist/ctx/IsomorphicTernSecureCtx.mjs.map +1 -1
- package/dist/ctx/TernSecureAuthResourcesCtx.d.mts +6 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.d.ts +6 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.js +2 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.js.map +1 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.mjs +2 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.mjs.map +1 -0
- package/dist/ctx/TernSecureCtxProvider.d.mts +6 -8
- package/dist/ctx/TernSecureCtxProvider.d.ts +6 -8
- package/dist/ctx/TernSecureCtxProvider.js +1 -1
- package/dist/ctx/TernSecureCtxProvider.js.map +1 -1
- package/dist/ctx/TernSecureCtxProvider.mjs +1 -1
- package/dist/ctx/TernSecureCtxProvider.mjs.map +1 -1
- package/dist/ctx/TernSecureProvider.js +1 -1
- package/dist/ctx/TernSecureProvider.js.map +1 -1
- package/dist/ctx/TernSecureProvider.mjs +1 -1
- package/dist/ctx/TernSecureProvider.mjs.map +1 -1
- package/dist/hooks/useAssertWrappedTernSecureProvider.d.mts +2 -2
- package/dist/hooks/useAssertWrappedTernSecureProvider.d.ts +2 -2
- package/dist/hooks/useAssertWrappedTernSecureProvider.js +2 -2
- package/dist/hooks/useAssertWrappedTernSecureProvider.js.map +1 -1
- package/dist/hooks/useAssertWrappedTernSecureProvider.mjs +2 -2
- package/dist/hooks/useAssertWrappedTernSecureProvider.mjs.map +1 -1
- package/dist/hooks/useAuth.d.mts +2 -2
- package/dist/hooks/useAuth.d.ts +2 -2
- package/dist/hooks/useAuth.js +1 -1
- package/dist/hooks/useAuth.js.map +1 -1
- package/dist/hooks/useAuth.mjs +1 -1
- package/dist/hooks/useAuth.mjs.map +1 -1
- package/dist/hooks/useIdToken.js +1 -1
- package/dist/hooks/useIdToken.js.map +1 -1
- package/dist/hooks/useIdToken.mjs +1 -1
- package/dist/hooks/useIdToken.mjs.map +1 -1
- package/dist/hooks/useSession.js +1 -1
- package/dist/hooks/useSession.js.map +1 -1
- package/dist/hooks/useSession.mjs +1 -1
- package/dist/hooks/useSession.mjs.map +1 -1
- package/dist/hooks/useSignIn.d.mts +17 -0
- package/dist/hooks/useSignIn.d.ts +17 -0
- package/dist/hooks/useSignIn.js +2 -0
- package/dist/hooks/useSignIn.js.map +1 -0
- package/dist/hooks/useSignIn.mjs +2 -0
- package/dist/hooks/useSignIn.mjs.map +1 -0
- package/dist/index.d.mts +2 -7
- package/dist/index.d.ts +2 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/lib/isoTernSecureAuth.d.mts +46 -0
- package/dist/lib/isoTernSecureAuth.d.ts +46 -0
- package/dist/lib/isoTernSecureAuth.js +2 -0
- package/dist/lib/isoTernSecureAuth.js.map +1 -0
- package/dist/lib/isoTernSecureAuth.mjs +2 -0
- package/dist/lib/isoTernSecureAuth.mjs.map +1 -0
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/types.d.mts +16 -6
- package/dist/types.d.ts +16 -6
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/config.js +2 -2
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/config.mjs +3 -3
- package/dist/utils/config.mjs.map +1 -1
- package/dist/utils/construct.js.map +1 -1
- package/dist/utils/construct.mjs +1 -1
- package/dist/utils/construct.mjs.map +1 -1
- package/dist/utils/debug.js +1 -1
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/debug.mjs +1 -1
- package/dist/utils/debug.mjs.map +1 -1
- package/package.json +6 -5
- package/dist/client/actions.d.mts +0 -2
- package/dist/client/actions.d.ts +0 -2
- package/dist/client/actions.js +0 -2
- package/dist/client/actions.js.map +0 -1
- package/dist/client/actions.mjs +0 -1
- package/dist/client/actions.mjs.map +0 -1
- package/dist/client/session.d.mts +0 -9
- package/dist/client/session.d.ts +0 -9
- package/dist/client/session.js +0 -2
- package/dist/client/session.js.map +0 -1
- package/dist/client/session.mjs +0 -2
- package/dist/client/session.mjs.map +0 -1
- package/dist/components/TernSecureHostRenderer.d.mts +0 -32
- package/dist/components/TernSecureHostRenderer.d.ts +0 -32
- package/dist/components/TernSecureHostRenderer.js +0 -2
- package/dist/components/TernSecureHostRenderer.js.map +0 -1
- package/dist/components/TernSecureHostRenderer.mjs +0 -2
- package/dist/components/TernSecureHostRenderer.mjs.map +0 -1
- package/dist/components/background.d.mts +0 -5
- package/dist/components/background.d.ts +0 -5
- package/dist/components/background.js +0 -2
- package/dist/components/background.js.map +0 -1
- package/dist/components/background.mjs +0 -2
- package/dist/components/background.mjs.map +0 -1
- package/dist/components/old.d.mts +0 -2
- package/dist/components/old.d.ts +0 -2
- package/dist/components/old.js +0 -2
- package/dist/components/old.js.map +0 -1
- package/dist/components/old.mjs +0 -1
- package/dist/components/old.mjs.map +0 -1
- package/dist/components/uiComponent.d.mts +0 -30
- package/dist/components/uiComponent.d.ts +0 -30
- package/dist/components/uiComponent.js +0 -2
- package/dist/components/uiComponent.js.map +0 -1
- package/dist/components/uiComponent.mjs +0 -2
- package/dist/components/uiComponent.mjs.map +0 -1
- package/dist/components/withTernSecure.d.mts +0 -19
- package/dist/components/withTernSecure.d.ts +0 -19
- package/dist/components/withTernSecure.js +0 -2
- package/dist/components/withTernSecure.js.map +0 -1
- package/dist/components/withTernSecure.mjs +0 -2
- package/dist/components/withTernSecure.mjs.map +0 -1
- package/dist/hooks/useAuthState.d.mts +0 -17
- package/dist/hooks/useAuthState.d.ts +0 -17
- package/dist/hooks/useAuthState.js +0 -2
- package/dist/hooks/useAuthState.js.map +0 -1
- package/dist/hooks/useAuthState.mjs +0 -2
- package/dist/hooks/useAuthState.mjs.map +0 -1
- package/dist/hooks/useMaxAllowedInstances.d.mts +0 -6
- package/dist/hooks/useMaxAllowedInstances.d.ts +0 -6
- package/dist/hooks/useMaxAllowedInstances.js +0 -2
- package/dist/hooks/useMaxAllowedInstances.js.map +0 -1
- package/dist/hooks/useMaxAllowedInstances.mjs +0 -2
- package/dist/hooks/useMaxAllowedInstances.mjs.map +0 -1
- package/dist/hooks/useSignUp.d.mts +0 -13
- package/dist/hooks/useSignUp.d.ts +0 -13
- package/dist/hooks/useSignUp.js +0 -2
- package/dist/hooks/useSignUp.js.map +0 -1
- package/dist/hooks/useSignUp.mjs +0 -2
- package/dist/hooks/useSignUp.mjs.map +0 -1
- package/dist/hooks/useWaitForComponentMount.d.mts +0 -8
- package/dist/hooks/useWaitForComponentMount.d.ts +0 -8
- package/dist/hooks/useWaitForComponentMount.js +0 -2
- package/dist/hooks/useWaitForComponentMount.js.map +0 -1
- package/dist/hooks/useWaitForComponentMount.mjs +0 -2
- package/dist/hooks/useWaitForComponentMount.mjs.map +0 -1
- package/dist/lib/isomorphicTernSecure.d.mts +0 -73
- package/dist/lib/isomorphicTernSecure.d.ts +0 -73
- package/dist/lib/isomorphicTernSecure.js +0 -2
- package/dist/lib/isomorphicTernSecure.js.map +0 -1
- package/dist/lib/isomorphicTernSecure.mjs +0 -2
- package/dist/lib/isomorphicTernSecure.mjs.map +0 -1
- package/dist/types/auth.d.mts +0 -2
- package/dist/types/auth.d.ts +0 -2
- package/dist/types/auth.js +0 -2
- package/dist/types/auth.js.map +0 -1
- package/dist/types/auth.mjs +0 -1
- package/dist/types/auth.mjs.map +0 -1
- package/dist/types/client/actions.d.ts +0 -2
- package/dist/types/client/actions.d.ts.map +0 -1
- package/dist/types/client/session.d.ts +0 -7
- package/dist/types/client/session.d.ts.map +0 -1
- package/dist/types/components/TernSecureHostRenderer.d.ts +0 -30
- package/dist/types/components/TernSecureHostRenderer.d.ts.map +0 -1
- package/dist/types/components/background.d.ts +0 -2
- package/dist/types/components/background.d.ts.map +0 -1
- package/dist/types/components/old.d.ts +0 -2
- package/dist/types/components/old.d.ts.map +0 -1
- package/dist/types/components/uiComponent.d.ts +0 -27
- package/dist/types/components/uiComponent.d.ts.map +0 -1
- package/dist/types/components/withTernSecure.d.ts +0 -16
- package/dist/types/components/withTernSecure.d.ts.map +0 -1
- package/dist/types/ctx/AuthProvider.d.ts +0 -3
- package/dist/types/ctx/AuthProvider.d.ts.map +0 -1
- package/dist/types/ctx/IsomorphicTernSecureCtx.d.ts +0 -6
- package/dist/types/ctx/IsomorphicTernSecureCtx.d.ts.map +0 -1
- package/dist/types/ctx/SessionCtx.d.ts +0 -2
- package/dist/types/ctx/SessionCtx.d.ts.map +0 -1
- package/dist/types/ctx/TernSecureCtxProvider.d.ts +0 -14
- package/dist/types/ctx/TernSecureCtxProvider.d.ts.map +0 -1
- package/dist/types/ctx/TernSecureProvider.d.ts +0 -6
- package/dist/types/ctx/TernSecureProvider.d.ts.map +0 -1
- package/dist/types/ctx/UserCtx.d.ts +0 -2
- package/dist/types/ctx/UserCtx.d.ts.map +0 -1
- package/dist/types/hooks/useAssertWrappedTernSecureProvider.d.ts +0 -2
- package/dist/types/hooks/useAssertWrappedTernSecureProvider.d.ts.map +0 -1
- package/dist/types/hooks/useAuth.d.ts +0 -3
- package/dist/types/hooks/useAuth.d.ts.map +0 -1
- package/dist/types/hooks/useAuthState.d.ts +0 -14
- package/dist/types/hooks/useAuthState.d.ts.map +0 -1
- package/dist/types/hooks/useIdToken.d.ts +0 -19
- package/dist/types/hooks/useIdToken.d.ts.map +0 -1
- package/dist/types/hooks/useMaxAllowedInstances.d.ts +0 -4
- package/dist/types/hooks/useMaxAllowedInstances.d.ts.map +0 -1
- package/dist/types/hooks/useSession.d.ts +0 -12
- package/dist/types/hooks/useSession.d.ts.map +0 -1
- package/dist/types/hooks/useSignUp.d.ts +0 -11
- package/dist/types/hooks/useSignUp.d.ts.map +0 -1
- package/dist/types/hooks/useWaitForComponentMount.d.ts +0 -8
- package/dist/types/hooks/useWaitForComponentMount.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -14
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lib/isomorphicTernSecure.d.ts +0 -70
- package/dist/types/lib/isomorphicTernSecure.d.ts.map +0 -1
- package/dist/types/lib/utils.d.ts +0 -3
- package/dist/types/lib/utils.d.ts.map +0 -1
- package/dist/types/route-handler/internal-route.d.ts +0 -13
- package/dist/types/route-handler/internal-route.d.ts.map +0 -1
- package/dist/types/types/auth.d.ts +0 -2
- package/dist/types/types/auth.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -94
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/utils/client-init.d.ts +0 -2
- package/dist/types/utils/client-init.d.ts.map +0 -1
- package/dist/types/utils/config.d.ts +0 -35
- package/dist/types/utils/config.d.ts.map +0 -1
- package/dist/types/utils/construct.d.ts +0 -38
- package/dist/types/utils/construct.d.ts.map +0 -1
- package/dist/types/utils/create-styles.d.ts +0 -99
- package/dist/types/utils/create-styles.d.ts.map +0 -1
- package/dist/types/utils/debug.d.ts +0 -13
- package/dist/types/utils/debug.d.ts.map +0 -1
- package/dist/types/utils/redirect.d.ts +0 -9
- package/dist/types/utils/redirect.d.ts.map +0 -1
- package/dist/utils/client-init.d.mts +0 -2
- package/dist/utils/client-init.d.ts +0 -2
- package/dist/utils/client-init.js +0 -2
- package/dist/utils/client-init.js.map +0 -1
- package/dist/utils/client-init.mjs +0 -1
- package/dist/utils/client-init.mjs.map +0 -1
package/dist/components/old.d.ts
DELETED
package/dist/components/old.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/components/old.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=old.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { SignInPropsTree, TernSecureInstanceTree, SignUpPropsTree } from '@tern-secure/types';
|
|
3
|
-
import { FallbackProp } from './withTernSecure.mjs';
|
|
4
|
-
import 'react';
|
|
5
|
-
|
|
6
|
-
type SignInComponentProps = SignInPropsTree & FallbackProp & {
|
|
7
|
-
component?: string;
|
|
8
|
-
instance: TernSecureInstanceTree;
|
|
9
|
-
};
|
|
10
|
-
type SignUpComponentProps = SignUpPropsTree & FallbackProp & {
|
|
11
|
-
component?: string;
|
|
12
|
-
instance: TernSecureInstanceTree;
|
|
13
|
-
};
|
|
14
|
-
declare const SignIn: {
|
|
15
|
-
(props: Omit<SignInComponentProps, "instance"> & FallbackProp): react_jsx_runtime.JSX.Element | null;
|
|
16
|
-
displayName: string;
|
|
17
|
-
};
|
|
18
|
-
declare const SignUp: {
|
|
19
|
-
(props: Omit<SignUpComponentProps, "instance"> & FallbackProp): react_jsx_runtime.JSX.Element | null;
|
|
20
|
-
displayName: string;
|
|
21
|
-
};
|
|
22
|
-
declare const UserButton: {
|
|
23
|
-
(props: Omit<{
|
|
24
|
-
instance: TernSecureInstanceTree;
|
|
25
|
-
component?: string;
|
|
26
|
-
}, "instance"> & FallbackProp): react_jsx_runtime.JSX.Element | null;
|
|
27
|
-
displayName: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export { SignIn, SignUp, UserButton };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { SignInPropsTree, TernSecureInstanceTree, SignUpPropsTree } from '@tern-secure/types';
|
|
3
|
-
import { FallbackProp } from './withTernSecure.js';
|
|
4
|
-
import 'react';
|
|
5
|
-
|
|
6
|
-
type SignInComponentProps = SignInPropsTree & FallbackProp & {
|
|
7
|
-
component?: string;
|
|
8
|
-
instance: TernSecureInstanceTree;
|
|
9
|
-
};
|
|
10
|
-
type SignUpComponentProps = SignUpPropsTree & FallbackProp & {
|
|
11
|
-
component?: string;
|
|
12
|
-
instance: TernSecureInstanceTree;
|
|
13
|
-
};
|
|
14
|
-
declare const SignIn: {
|
|
15
|
-
(props: Omit<SignInComponentProps, "instance"> & FallbackProp): react_jsx_runtime.JSX.Element | null;
|
|
16
|
-
displayName: string;
|
|
17
|
-
};
|
|
18
|
-
declare const SignUp: {
|
|
19
|
-
(props: Omit<SignUpComponentProps, "instance"> & FallbackProp): react_jsx_runtime.JSX.Element | null;
|
|
20
|
-
displayName: string;
|
|
21
|
-
};
|
|
22
|
-
declare const UserButton: {
|
|
23
|
-
(props: Omit<{
|
|
24
|
-
instance: TernSecureInstanceTree;
|
|
25
|
-
component?: string;
|
|
26
|
-
}, "instance"> & FallbackProp): react_jsx_runtime.JSX.Element | null;
|
|
27
|
-
displayName: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export { SignIn, SignUp, UserButton };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var P=(n,o)=>{for(var e in o)a(n,e,{get:o[e],enumerable:!0})},l=(n,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of U(o))!y.call(n,s)&&s!==e&&a(n,s,{get:()=>o[s],enumerable:!(r=h(o,s))||r.enumerable});return n};var I=n=>l(a({},"__esModule",{value:!0}),n);var f={};P(f,{SignIn:()=>R,SignUp:()=>C,UserButton:()=>w});module.exports=I(f);var t=require("react/jsx-runtime"),i=require("react"),u=require("./TernSecureHostRenderer"),S=require("./withTernSecure"),d=require("../hooks/useWaitForComponentMount");const T=(n,o,e)=>{console.log(`[TernSecure:${n}] ${o}`,e||"")},R=(0,S.withTernSecure)(({instance:n,component:o,fallback:e,ui:r})=>{const p=(0,d.useWaitForComponentMount)(o)==="rendering"||!n.isReady,g=(0,i.useMemo)(()=>({...r}),[r]),m=(0,i.useMemo)(()=>({...p&&e&&{style:{display:"none"}}}),[p,e]);return(0,t.jsxs)(t.Fragment,{children:[p&&e,n.isReady&&(0,t.jsx)(u.TernSecureHostRenderer,{component:o,mount:n.showSignIn,unmount:n.hideSignIn,props:g,rootProps:m})]})},{component:"SignIn",renderWhileLoading:!0}),C=(0,S.withTernSecure)(({instance:n,component:o,fallback:e,ui:r,forceRedirectUrl:s})=>{const p=(0,d.useWaitForComponentMount)(o),g=p==="rendering"||!n.isReady;(0,i.useEffect)(()=>{T("SignUp","Instance Status",{isReady:n.isReady,mountingStatus:p,hasSignUpMethod:!!n.showSignUp,hasConfig:!!r})},[n.isReady,p,n.showSignUp,r]);const m=(0,i.useMemo)(()=>({...r,forceRedirectUrl:s}),[r,s]),c=(0,i.useMemo)(()=>({...g&&e&&{style:{display:"none"}}}),[g,e]);return(0,t.jsxs)(t.Fragment,{children:[g&&e,n.isReady&&(0,t.jsx)(u.TernSecureHostRenderer,{component:o,mount:n.showSignUp,unmount:n.hideSignUp,props:m,rootProps:c})]})},{component:"SignUp",renderWhileLoading:!0}),w=(0,S.withTernSecure)(({instance:n,component:o})=>{const r=(0,d.useWaitForComponentMount)(o)==="rendering"||!n.isReady;return(0,t.jsxs)(t.Fragment,{children:[r,n.isReady&&(0,t.jsx)(u.TernSecureHostRenderer,{component:o,mount:n.showUserButton,unmount:n.hideUserButton,props:{},rootProps:{...r&&{style:{display:"none"}}}})]})},{component:"UserButton",renderWhileLoading:!0});0&&(module.exports={SignIn,SignUp,UserButton});
|
|
2
|
-
//# sourceMappingURL=uiComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/uiComponent.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useEffect } from 'react';\nimport type {\n SignInPropsTree, \n TernSecureInstanceTree, \n SignInUIConfig, \n SignUpUIConfig,\n SignUpPropsTree\n} from '@tern-secure/types';\nimport { TernSecureHostRenderer } from './TernSecureHostRenderer';\nimport { withTernSecure, FallbackProp } from './withTernSecure';\nimport { useWaitForComponentMount } from '../hooks/useWaitForComponentMount';\n\nconst debugLog = (component: string, action: string, data?: any) => {\n console.log(`[TernSecure:${component}] ${action}`, data || '');\n};\n\n\n// Internal component props including instance from withTernSecure\ntype SignInComponentProps = SignInPropsTree & FallbackProp & {\n component?: string;\n instance: TernSecureInstanceTree;\n};\n\n\ntype SignUpComponentProps = SignUpPropsTree & FallbackProp & {\n component?: string;\n instance: TernSecureInstanceTree;\n};\n\nexport const SignIn = withTernSecure(\n ({ instance, component, fallback, ui }: SignInComponentProps) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !instance.isReady;\n\n\n\n const rendererProps = useMemo(() => ({\n ...ui,\n //signIn: instance.signIn,\n } as SignInUIConfig), [ui]);\n\n const rendererRootProps = useMemo(() => ({\n ...(shouldShowFallback && fallback && { style: { display: 'none' } }),\n }), [shouldShowFallback, fallback]);\n\n return (\n <>\n {shouldShowFallback && fallback}\n {instance.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={instance.showSignIn}\n unmount={instance.hideSignIn}\n //updateProps={instance.up}\n props={rendererProps}\n rootProps={rendererRootProps}\n />\n )}\n </>\n );\n },\n { component: 'SignIn', renderWhileLoading: true }\n);\n\n\nexport const SignUp = withTernSecure(\n ({ instance, component, fallback, ui, forceRedirectUrl }: SignUpComponentProps) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !instance.isReady;\n\n useEffect(() => {\n debugLog('SignUp', 'Instance Status', {\n isReady: instance.isReady,\n mountingStatus,\n hasSignUpMethod: !!instance.showSignUp,\n hasConfig: !!ui,\n });\n }, [instance.isReady, mountingStatus, instance.showSignUp, ui]);\n\n{/* const mount = useCallback((el: HTMLDivElement) => {\n debugLog('SignUp', 'Mounting', { config });\n instance.showSignUp(el, config);\n }, [instance, config]);\n\n const unmount = useCallback((el: HTMLDivElement) => {\n debugLog('SignUp', 'Unmounting');\n instance.hideSignUp(el);\n }, [instance]);\n\n const updateProps = useCallback((params: { node: HTMLDivElement; props: SignUpUIConfig }) => {\n debugLog('SignUp', 'Updating Props', params.props);\n instance.showSignUp(params.node, params.props);\n }, [instance]); */}\n\n const rendererProps = useMemo(() => ({\n ...ui,\n forceRedirectUrl,\n //signIn: instance.signIn,\n } as SignUpUIConfig), [ui, forceRedirectUrl]);\n\n const rendererRootProps = useMemo(() => ({\n ...(shouldShowFallback && fallback && { style: { display: 'none' } }),\n }), [shouldShowFallback, fallback]);\n\n return (\n <>\n {shouldShowFallback && fallback}\n {instance.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={instance.showSignUp}\n unmount={instance.hideSignUp}\n //updateProps={instance.}\n props={rendererProps}\n rootProps={rendererRootProps}\n />\n )}\n </>\n );\n },\n { component: 'SignUp', renderWhileLoading: true }\n);\n\n\nexport const UserButton = withTernSecure(\n ({ instance, component}) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !instance.isReady;\n\n return (\n <>\n {shouldShowFallback}\n {instance.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={instance.showUserButton}\n unmount={instance.hideUserButton}\n props={{}}\n rootProps={{\n ...(shouldShowFallback && { style: { display: 'none' } }),\n }}\n />\n )}\n </>\n );\n },\n { component: 'UserButton', renderWhileLoading: true }\n);\n\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,WAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,GA8CM,IAAAM,EAAA,6BA9CNC,EAAuD,iBAQvDC,EAAuC,oCACvCC,EAA6C,4BAC7CC,EAAyC,6CAEzC,MAAMC,EAAW,CAACC,EAAmBC,EAAgBC,IAAe,CAClE,QAAQ,IAAI,eAAeF,CAAS,KAAKC,CAAM,GAAIC,GAAQ,EAAE,CAC/D,EAeaZ,KAAS,kBACpB,CAAC,CAAE,SAAAa,EAAU,UAAAH,EAAW,SAAAI,EAAU,GAAAC,CAAG,IAA4B,CAE/D,MAAMC,KADiB,4BAAyBN,CAAS,IACX,aAAe,CAACG,EAAS,QAIjEI,KAAgB,WAAQ,KAAO,CACnC,GAAGF,CAEL,GAAsB,CAACA,CAAE,CAAC,EAEpBG,KAAoB,WAAQ,KAAO,CACvC,GAAIF,GAAsBF,GAAY,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACrE,GAAI,CAACE,EAAoBF,CAAQ,CAAC,EAElC,SACE,oBACG,UAAAE,GAAsBF,EACtBD,EAAS,YACR,OAAC,0BACC,UAAWH,EACX,MAAOG,EAAS,WAChB,QAASA,EAAS,WAElB,MAAOI,EACP,UAAWC,EACb,GAEJ,CAEJ,EACA,CAAE,UAAW,SAAU,mBAAoB,EAAK,CAClD,EAGajB,KAAS,kBACpB,CAAC,CAAE,SAAAY,EAAU,UAAAH,EAAW,SAAAI,EAAU,GAAAC,EAAI,iBAAAI,CAAiB,IAA4B,CACjF,MAAMC,KAAiB,4BAAyBV,CAAS,EACnDM,EAAqBI,IAAmB,aAAe,CAACP,EAAS,WAEvE,aAAU,IAAM,CACdJ,EAAS,SAAU,kBAAmB,CACpC,QAASI,EAAS,QAClB,eAAAO,EACA,gBAAiB,CAAC,CAACP,EAAS,WAC5B,UAAW,CAAC,CAACE,CACf,CAAC,CACH,EAAG,CAACF,EAAS,QAASO,EAAgBP,EAAS,WAAYE,CAAE,CAAC,EAiB9D,MAAME,KAAgB,WAAQ,KAAO,CACnC,GAAGF,EACH,iBAAAI,CAEF,GAAsB,CAACJ,EAAII,CAAgB,CAAC,EAEtCD,KAAoB,WAAQ,KAAO,CACvC,GAAIF,GAAsBF,GAAY,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACrE,GAAI,CAACE,EAAoBF,CAAQ,CAAC,EAElC,SACE,oBACG,UAAAE,GAAsBF,EACtBD,EAAS,YACR,OAAC,0BACC,UAAWH,EACX,MAAOG,EAAS,WAChB,QAASA,EAAS,WAElB,MAAOI,EACP,UAAWC,EACb,GAEJ,CAEJ,EACA,CAAE,UAAW,SAAU,mBAAoB,EAAK,CAClD,EAGahB,KAAa,kBACxB,CAAC,CAAE,SAAAW,EAAU,UAAAH,CAAS,IAAM,CAE1B,MAAMM,KADiB,4BAAyBN,CAAS,IACX,aAAe,CAACG,EAAS,QAEvE,SACE,oBACG,UAAAG,EACAH,EAAS,YACR,OAAC,0BACC,UAAWH,EACX,MAAOG,EAAS,eAChB,QAASA,EAAS,eAClB,MAAO,CAAC,EACR,UAAW,CACT,GAAIG,GAAsB,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACzD,EACF,GAEJ,CAEJ,EACA,CAAE,UAAW,aAAc,mBAAoB,EAAK,CACtD","names":["uiComponent_exports","__export","SignIn","SignUp","UserButton","__toCommonJS","import_jsx_runtime","import_react","import_TernSecureHostRenderer","import_withTernSecure","import_useWaitForComponentMount","debugLog","component","action","data","instance","fallback","ui","shouldShowFallback","rendererProps","rendererRootProps","forceRedirectUrl","mountingStatus"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Fragment as a,jsx as m,jsxs as c}from"react/jsx-runtime";import{useMemo as p,useEffect as U}from"react";import{TernSecureHostRenderer as u}from"./TernSecureHostRenderer";import{withTernSecure as S}from"./withTernSecure";import{useWaitForComponentMount as d}from"../hooks/useWaitForComponentMount";const y=(n,o,e)=>{console.log(`[TernSecure:${n}] ${o}`,e||"")},f=S(({instance:n,component:o,fallback:e,ui:r})=>{const t=d(o)==="rendering"||!n.isReady,s=p(()=>({...r}),[r]),g=p(()=>({...t&&e&&{style:{display:"none"}}}),[t,e]);return c(a,{children:[t&&e,n.isReady&&m(u,{component:o,mount:n.showSignIn,unmount:n.hideSignIn,props:s,rootProps:g})]})},{component:"SignIn",renderWhileLoading:!0}),F=S(({instance:n,component:o,fallback:e,ui:r,forceRedirectUrl:i})=>{const t=d(o),s=t==="rendering"||!n.isReady;U(()=>{y("SignUp","Instance Status",{isReady:n.isReady,mountingStatus:t,hasSignUpMethod:!!n.showSignUp,hasConfig:!!r})},[n.isReady,t,n.showSignUp,r]);const g=p(()=>({...r,forceRedirectUrl:i}),[r,i]),h=p(()=>({...s&&e&&{style:{display:"none"}}}),[s,e]);return c(a,{children:[s&&e,n.isReady&&m(u,{component:o,mount:n.showSignUp,unmount:n.hideSignUp,props:g,rootProps:h})]})},{component:"SignUp",renderWhileLoading:!0}),b=S(({instance:n,component:o})=>{const r=d(o)==="rendering"||!n.isReady;return c(a,{children:[r,n.isReady&&m(u,{component:o,mount:n.showUserButton,unmount:n.hideUserButton,props:{},rootProps:{...r&&{style:{display:"none"}}}})]})},{component:"UserButton",renderWhileLoading:!0});export{f as SignIn,F as SignUp,b as UserButton};
|
|
2
|
-
//# sourceMappingURL=uiComponent.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/uiComponent.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useEffect } from 'react';\nimport type {\n SignInPropsTree, \n TernSecureInstanceTree, \n SignInUIConfig, \n SignUpUIConfig,\n SignUpPropsTree\n} from '@tern-secure/types';\nimport { TernSecureHostRenderer } from './TernSecureHostRenderer';\nimport { withTernSecure, FallbackProp } from './withTernSecure';\nimport { useWaitForComponentMount } from '../hooks/useWaitForComponentMount';\n\nconst debugLog = (component: string, action: string, data?: any) => {\n console.log(`[TernSecure:${component}] ${action}`, data || '');\n};\n\n\n// Internal component props including instance from withTernSecure\ntype SignInComponentProps = SignInPropsTree & FallbackProp & {\n component?: string;\n instance: TernSecureInstanceTree;\n};\n\n\ntype SignUpComponentProps = SignUpPropsTree & FallbackProp & {\n component?: string;\n instance: TernSecureInstanceTree;\n};\n\nexport const SignIn = withTernSecure(\n ({ instance, component, fallback, ui }: SignInComponentProps) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !instance.isReady;\n\n\n\n const rendererProps = useMemo(() => ({\n ...ui,\n //signIn: instance.signIn,\n } as SignInUIConfig), [ui]);\n\n const rendererRootProps = useMemo(() => ({\n ...(shouldShowFallback && fallback && { style: { display: 'none' } }),\n }), [shouldShowFallback, fallback]);\n\n return (\n <>\n {shouldShowFallback && fallback}\n {instance.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={instance.showSignIn}\n unmount={instance.hideSignIn}\n //updateProps={instance.up}\n props={rendererProps}\n rootProps={rendererRootProps}\n />\n )}\n </>\n );\n },\n { component: 'SignIn', renderWhileLoading: true }\n);\n\n\nexport const SignUp = withTernSecure(\n ({ instance, component, fallback, ui, forceRedirectUrl }: SignUpComponentProps) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !instance.isReady;\n\n useEffect(() => {\n debugLog('SignUp', 'Instance Status', {\n isReady: instance.isReady,\n mountingStatus,\n hasSignUpMethod: !!instance.showSignUp,\n hasConfig: !!ui,\n });\n }, [instance.isReady, mountingStatus, instance.showSignUp, ui]);\n\n{/* const mount = useCallback((el: HTMLDivElement) => {\n debugLog('SignUp', 'Mounting', { config });\n instance.showSignUp(el, config);\n }, [instance, config]);\n\n const unmount = useCallback((el: HTMLDivElement) => {\n debugLog('SignUp', 'Unmounting');\n instance.hideSignUp(el);\n }, [instance]);\n\n const updateProps = useCallback((params: { node: HTMLDivElement; props: SignUpUIConfig }) => {\n debugLog('SignUp', 'Updating Props', params.props);\n instance.showSignUp(params.node, params.props);\n }, [instance]); */}\n\n const rendererProps = useMemo(() => ({\n ...ui,\n forceRedirectUrl,\n //signIn: instance.signIn,\n } as SignUpUIConfig), [ui, forceRedirectUrl]);\n\n const rendererRootProps = useMemo(() => ({\n ...(shouldShowFallback && fallback && { style: { display: 'none' } }),\n }), [shouldShowFallback, fallback]);\n\n return (\n <>\n {shouldShowFallback && fallback}\n {instance.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={instance.showSignUp}\n unmount={instance.hideSignUp}\n //updateProps={instance.}\n props={rendererProps}\n rootProps={rendererRootProps}\n />\n )}\n </>\n );\n },\n { component: 'SignUp', renderWhileLoading: true }\n);\n\n\nexport const UserButton = withTernSecure(\n ({ instance, component}) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !instance.isReady;\n\n return (\n <>\n {shouldShowFallback}\n {instance.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={instance.showUserButton}\n unmount={instance.hideUserButton}\n props={{}}\n rootProps={{\n ...(shouldShowFallback && { style: { display: 'none' } }),\n }}\n />\n )}\n </>\n );\n },\n { component: 'UserButton', renderWhileLoading: true }\n);\n\n"],"mappings":"AA8CM,mBAAAA,EAGI,OAAAC,EAHJ,QAAAC,MAAA,oBA9CN,OAA6B,WAAAC,EAAS,aAAAC,MAAiB,QAQvD,OAAS,0BAAAC,MAA8B,2BACvC,OAAS,kBAAAC,MAAoC,mBAC7C,OAAS,4BAAAC,MAAgC,oCAEzC,MAAMC,EAAW,CAACC,EAAmBC,EAAgBC,IAAe,CAClE,QAAQ,IAAI,eAAeF,CAAS,KAAKC,CAAM,GAAIC,GAAQ,EAAE,CAC/D,EAeaC,EAASN,EACpB,CAAC,CAAE,SAAAO,EAAU,UAAAJ,EAAW,SAAAK,EAAU,GAAAC,CAAG,IAA4B,CAE/D,MAAMC,EADiBT,EAAyBE,CAAS,IACX,aAAe,CAACI,EAAS,QAIjEI,EAAgBd,EAAQ,KAAO,CACnC,GAAGY,CAEL,GAAsB,CAACA,CAAE,CAAC,EAEpBG,EAAoBf,EAAQ,KAAO,CACvC,GAAIa,GAAsBF,GAAY,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACrE,GAAI,CAACE,EAAoBF,CAAQ,CAAC,EAElC,OACEZ,EAAAF,EAAA,CACG,UAAAgB,GAAsBF,EACtBD,EAAS,SACRZ,EAACI,EAAA,CACC,UAAWI,EACX,MAAOI,EAAS,WAChB,QAASA,EAAS,WAElB,MAAOI,EACP,UAAWC,EACb,GAEJ,CAEJ,EACA,CAAE,UAAW,SAAU,mBAAoB,EAAK,CAClD,EAGaC,EAASb,EACpB,CAAC,CAAE,SAAAO,EAAU,UAAAJ,EAAW,SAAAK,EAAU,GAAAC,EAAI,iBAAAK,CAAiB,IAA4B,CACjF,MAAMC,EAAiBd,EAAyBE,CAAS,EACnDO,EAAqBK,IAAmB,aAAe,CAACR,EAAS,QAEvET,EAAU,IAAM,CACdI,EAAS,SAAU,kBAAmB,CACpC,QAASK,EAAS,QAClB,eAAAQ,EACA,gBAAiB,CAAC,CAACR,EAAS,WAC5B,UAAW,CAAC,CAACE,CACf,CAAC,CACH,EAAG,CAACF,EAAS,QAASQ,EAAgBR,EAAS,WAAYE,CAAE,CAAC,EAiB9D,MAAME,EAAgBd,EAAQ,KAAO,CACnC,GAAGY,EACH,iBAAAK,CAEF,GAAsB,CAACL,EAAIK,CAAgB,CAAC,EAEtCF,EAAoBf,EAAQ,KAAO,CACvC,GAAIa,GAAsBF,GAAY,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACrE,GAAI,CAACE,EAAoBF,CAAQ,CAAC,EAElC,OACEZ,EAAAF,EAAA,CACG,UAAAgB,GAAsBF,EACtBD,EAAS,SACRZ,EAACI,EAAA,CACC,UAAWI,EACX,MAAOI,EAAS,WAChB,QAASA,EAAS,WAElB,MAAOI,EACP,UAAWC,EACb,GAEJ,CAEJ,EACA,CAAE,UAAW,SAAU,mBAAoB,EAAK,CAClD,EAGaI,EAAahB,EACxB,CAAC,CAAE,SAAAO,EAAU,UAAAJ,CAAS,IAAM,CAE1B,MAAMO,EADiBT,EAAyBE,CAAS,IACX,aAAe,CAACI,EAAS,QAEvE,OACEX,EAAAF,EAAA,CACG,UAAAgB,EACAH,EAAS,SACRZ,EAACI,EAAA,CACC,UAAWI,EACX,MAAOI,EAAS,eAChB,QAASA,EAAS,eAClB,MAAO,CAAC,EACR,UAAW,CACT,GAAIG,GAAsB,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACzD,EACF,GAEJ,CAEJ,EACA,CAAE,UAAW,aAAc,mBAAoB,EAAK,CACtD","names":["Fragment","jsx","jsxs","useMemo","useEffect","TernSecureHostRenderer","withTernSecure","useWaitForComponentMount","debugLog","component","action","data","SignIn","instance","fallback","ui","shouldShowFallback","rendererProps","rendererRootProps","SignUp","forceRedirectUrl","mountingStatus","UserButton"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import { TernSecureInstanceTree } from '@tern-secure/types';
|
|
4
|
-
|
|
5
|
-
interface FallbackProp {
|
|
6
|
-
fallback?: React__default.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
declare const withTernSecure: <P extends {
|
|
9
|
-
instance: TernSecureInstanceTree;
|
|
10
|
-
component?: string;
|
|
11
|
-
}>(Component: React__default.ComponentType<P>, options?: {
|
|
12
|
-
component: string;
|
|
13
|
-
renderWhileLoading?: boolean;
|
|
14
|
-
}) => {
|
|
15
|
-
(props: Omit<P, "instance"> & FallbackProp): react_jsx_runtime.JSX.Element | null;
|
|
16
|
-
displayName: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { type FallbackProp, withTernSecure };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import { TernSecureInstanceTree } from '@tern-secure/types';
|
|
4
|
-
|
|
5
|
-
interface FallbackProp {
|
|
6
|
-
fallback?: React__default.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
declare const withTernSecure: <P extends {
|
|
9
|
-
instance: TernSecureInstanceTree;
|
|
10
|
-
component?: string;
|
|
11
|
-
}>(Component: React__default.ComponentType<P>, options?: {
|
|
12
|
-
component: string;
|
|
13
|
-
renderWhileLoading?: boolean;
|
|
14
|
-
}) => {
|
|
15
|
-
(props: Omit<P, "instance"> & FallbackProp): react_jsx_runtime.JSX.Element | null;
|
|
16
|
-
displayName: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { type FallbackProp, withTernSecure };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var m=(n,e)=>{for(var r in e)s(n,r,{get:e[r],enumerable:!0})},S=(n,e,r,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of d(e))!l.call(n,t)&&t!==r&&s(n,t,{get:()=>e[t],enumerable:!(c=u(e,t))||c.enumerable});return n};var T=n=>S(s({},"__esModule",{value:!0}),n);var y={};m(y,{withTernSecure:()=>h});module.exports=T(y);var p=require("react/jsx-runtime"),o=require("../ctx/IsomorphicTernSecureCtx"),i=require("../hooks/useAssertWrappedTernSecureProvider");const h=(n,e)=>{const r=e?.component||n.displayName||n.name||"Component",c=t=>{(0,i.useAssertWrappedByTernSecureProvider)(r||"withTernSecure");const a=(0,o.useIsomorphicTernSecureCtx)();return console.log(`[TernSecure] ${r} - Instance Status:`,{isReady:a.isReady,status:a.status,hasInstance:!!a,hasShowSignIn:!!a.showSignIn,renderWhileLoading:e?.renderWhileLoading}),!a.isReady&&!e?.renderWhileLoading?null:(0,p.jsx)(n,{...t,component:r,instance:a})};return c.displayName=`withTernSecure(${r})`,c};0&&(module.exports={withTernSecure});
|
|
2
|
-
//# sourceMappingURL=withTernSecure.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/withTernSecure.tsx"],"sourcesContent":["import React from 'react';\nimport type { TernSecureInstanceTree } from '@tern-secure/types';\nimport { useIsomorphicTernSecureCtx } from '../ctx/IsomorphicTernSecureCtx';\nimport { useAssertWrappedByTernSecureProvider } from '../hooks/useAssertWrappedTernSecureProvider';\n\ntype WithTernSecureProp<P> = P & {\n instance: TernSecureInstanceTree;\n component?: string;\n};\n\n\nexport interface FallbackProp {\n fallback?: React.ReactNode;\n}\n\nexport const withTernSecure = <P extends { instance: TernSecureInstanceTree; component?: string }>(\n Component: React.ComponentType<P>,\n options?: { component: string; renderWhileLoading?: boolean },\n) => {\n const displayName = options?.component || Component.displayName || Component.name || 'Component';\n\n const HOC = (props: Omit<P, 'instance'> & FallbackProp) => {\n useAssertWrappedByTernSecureProvider(displayName || 'withTernSecure');\n\n const instance = useIsomorphicTernSecureCtx();\n\n console.log(\n `[TernSecure] ${displayName} - Instance Status:`,\n {\n isReady: instance.isReady,\n status: instance.status,\n hasInstance: !!instance,\n hasShowSignIn: !!(instance as any).showSignIn,\n renderWhileLoading: options?.renderWhileLoading\n }\n );\n\n if (!instance.isReady && !options?.renderWhileLoading) {\n return null;\n }\n\n return (\n <Component\n {...(props as P)}\n component={displayName}\n instance={instance}\n />\n );\n };\n\n HOC.displayName = `withTernSecure(${displayName})`;\n return HOC;\n};\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GA0CM,IAAAI,EAAA,6BAxCNC,EAA2C,0CAC3CC,EAAqD,uDAY9C,MAAMJ,EAAiB,CAC5BK,EACAC,IACG,CACH,MAAMC,EAAcD,GAAS,WAAaD,EAAU,aAAeA,EAAU,MAAQ,YAE/EG,EAAOC,GAA8C,IACzD,wCAAqCF,GAAe,gBAAgB,EAEpE,MAAMG,KAAW,8BAA2B,EAa5C,OAXA,QAAQ,IACN,gBAAgBH,CAAW,sBAC3B,CACE,QAASG,EAAS,QAClB,OAAQA,EAAS,OACjB,YAAa,CAAC,CAACA,EACf,cAAe,CAAC,CAAEA,EAAiB,WACnC,mBAAoBJ,GAAS,kBAC/B,CACF,EAEI,CAACI,EAAS,SAAW,CAACJ,GAAS,mBAC1B,QAIP,OAACD,EAAA,CACE,GAAII,EACL,UAAWF,EACX,SAAUG,EACZ,CAEJ,EAEA,OAAAF,EAAI,YAAc,kBAAkBD,CAAW,IACxCC,CACT","names":["withTernSecure_exports","__export","withTernSecure","__toCommonJS","import_jsx_runtime","import_IsomorphicTernSecureCtx","import_useAssertWrappedTernSecureProvider","Component","options","displayName","HOC","props","instance"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as i}from"react/jsx-runtime";import{useIsomorphicTernSecureCtx as s}from"../ctx/IsomorphicTernSecureCtx";import{useAssertWrappedByTernSecureProvider as o}from"../hooks/useAssertWrappedTernSecureProvider";const m=(r,t)=>{const n=t?.component||r.displayName||r.name||"Component",a=c=>{o(n||"withTernSecure");const e=s();return console.log(`[TernSecure] ${n} - Instance Status:`,{isReady:e.isReady,status:e.status,hasInstance:!!e,hasShowSignIn:!!e.showSignIn,renderWhileLoading:t?.renderWhileLoading}),!e.isReady&&!t?.renderWhileLoading?null:i(r,{...c,component:n,instance:e})};return a.displayName=`withTernSecure(${n})`,a};export{m as withTernSecure};
|
|
2
|
-
//# sourceMappingURL=withTernSecure.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/withTernSecure.tsx"],"sourcesContent":["import React from 'react';\nimport type { TernSecureInstanceTree } from '@tern-secure/types';\nimport { useIsomorphicTernSecureCtx } from '../ctx/IsomorphicTernSecureCtx';\nimport { useAssertWrappedByTernSecureProvider } from '../hooks/useAssertWrappedTernSecureProvider';\n\ntype WithTernSecureProp<P> = P & {\n instance: TernSecureInstanceTree;\n component?: string;\n};\n\n\nexport interface FallbackProp {\n fallback?: React.ReactNode;\n}\n\nexport const withTernSecure = <P extends { instance: TernSecureInstanceTree; component?: string }>(\n Component: React.ComponentType<P>,\n options?: { component: string; renderWhileLoading?: boolean },\n) => {\n const displayName = options?.component || Component.displayName || Component.name || 'Component';\n\n const HOC = (props: Omit<P, 'instance'> & FallbackProp) => {\n useAssertWrappedByTernSecureProvider(displayName || 'withTernSecure');\n\n const instance = useIsomorphicTernSecureCtx();\n\n console.log(\n `[TernSecure] ${displayName} - Instance Status:`,\n {\n isReady: instance.isReady,\n status: instance.status,\n hasInstance: !!instance,\n hasShowSignIn: !!(instance as any).showSignIn,\n renderWhileLoading: options?.renderWhileLoading\n }\n );\n\n if (!instance.isReady && !options?.renderWhileLoading) {\n return null;\n }\n\n return (\n <Component\n {...(props as P)}\n component={displayName}\n instance={instance}\n />\n );\n };\n\n HOC.displayName = `withTernSecure(${displayName})`;\n return HOC;\n};\n"],"mappings":"AA0CM,cAAAA,MAAA,oBAxCN,OAAS,8BAAAC,MAAkC,iCAC3C,OAAS,wCAAAC,MAA4C,8CAY9C,MAAMC,EAAiB,CAC5BC,EACAC,IACG,CACH,MAAMC,EAAcD,GAAS,WAAaD,EAAU,aAAeA,EAAU,MAAQ,YAE/EG,EAAOC,GAA8C,CACzDN,EAAqCI,GAAe,gBAAgB,EAEpE,MAAMG,EAAWR,EAA2B,EAa5C,OAXA,QAAQ,IACN,gBAAgBK,CAAW,sBAC3B,CACE,QAASG,EAAS,QAClB,OAAQA,EAAS,OACjB,YAAa,CAAC,CAACA,EACf,cAAe,CAAC,CAAEA,EAAiB,WACnC,mBAAoBJ,GAAS,kBAC/B,CACF,EAEI,CAACI,EAAS,SAAW,CAACJ,GAAS,mBAC1B,KAIPL,EAACI,EAAA,CACE,GAAII,EACL,UAAWF,EACX,SAAUG,EACZ,CAEJ,EAEA,OAAAF,EAAI,YAAc,kBAAkBD,CAAW,IACxCC,CACT","names":["jsx","useIsomorphicTernSecureCtx","useAssertWrappedByTernSecureProvider","withTernSecure","Component","options","displayName","HOC","props","instance"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IsomorphicTernSecure } from '../lib/isomorphicTernSecure.mjs';
|
|
2
|
-
import { TernSecureState } from '@tern-secure/types';
|
|
3
|
-
import React__default from 'react';
|
|
4
|
-
import '../types.mjs';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Custom hook that manages auth state and provides subscription callback.
|
|
8
|
-
* @param instance The IsomorphicTernSecure instance
|
|
9
|
-
* @returns Tuple containing [authState, setAuthState, subscribeToAuthState]
|
|
10
|
-
*/
|
|
11
|
-
declare function useAuthState(instance: IsomorphicTernSecure | null): [
|
|
12
|
-
TernSecureState | null,
|
|
13
|
-
React__default.Dispatch<React__default.SetStateAction<TernSecureState | null>>,
|
|
14
|
-
() => () => void
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
export { useAuthState };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IsomorphicTernSecure } from '../lib/isomorphicTernSecure.js';
|
|
2
|
-
import { TernSecureState } from '@tern-secure/types';
|
|
3
|
-
import React__default from 'react';
|
|
4
|
-
import '../types.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Custom hook that manages auth state and provides subscription callback.
|
|
8
|
-
* @param instance The IsomorphicTernSecure instance
|
|
9
|
-
* @returns Tuple containing [authState, setAuthState, subscribeToAuthState]
|
|
10
|
-
*/
|
|
11
|
-
declare function useAuthState(instance: IsomorphicTernSecure | null): [
|
|
12
|
-
TernSecureState | null,
|
|
13
|
-
React__default.Dispatch<React__default.SetStateAction<TernSecureState | null>>,
|
|
14
|
-
() => () => void
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
export { useAuthState };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var S=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var i=(t,e)=>{for(var r in e)S(t,r,{get:e[r],enumerable:!0})},p=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of s(e))!h.call(t,u)&&u!==r&&S(t,u,{get:()=>e[u],enumerable:!(n=l(e,u))||n.enumerable});return t};var A=t=>p(S({},"__esModule",{value:!0}),t);var m={};i(m,{useAuthState:()=>T});module.exports=A(m);var o=require("react");function T(t){const[e,r]=(0,o.useState)(t?.ternAuth?.internalAuthState||null),n=(0,o.useCallback)(()=>{if(!t?.ternAuth||!t.events)return()=>{};const u=t.ternAuth.internalAuthState;r(u);const c=t.events.onAuthStateChanged(a=>{console.log("[useAuthState] Auth state changed:",a),r(a)});return()=>{c?.()}},[t]);return[e,r,n]}0&&(module.exports={useAuthState});
|
|
2
|
-
//# sourceMappingURL=useAuthState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useAuthState.tsx"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport type { IsomorphicTernSecure } from '../lib/isomorphicTernSecure';\nimport type { TernSecureState, DEFAULT_TERN_SECURE_STATE } from '@tern-secure/types';\nimport type React from 'react';\n\n/**\n * Custom hook that manages auth state and provides subscription callback.\n * @param instance The IsomorphicTernSecure instance\n * @returns Tuple containing [authState, setAuthState, subscribeToAuthState]\n */\nexport function useAuthState(\n instance: IsomorphicTernSecure | null\n): [\n TernSecureState | null, \n React.Dispatch<React.SetStateAction<TernSecureState | null>>,\n () => () => void\n] {\n const [authState, setAuthState] = useState<TernSecureState | null>(\n instance?.ternAuth?.internalAuthState || null\n );\n\n const subscribeToAuthState = useCallback(() => {\n if (!instance?.ternAuth || !instance.events) {\n return () => {}; // Return no-op cleanup function\n }\n\n // Set initial state\n const currentInternalState = instance.ternAuth.internalAuthState;\n setAuthState(currentInternalState);\n\n // Subscribe to changes\n const unsubscribe = instance.events.onAuthStateChanged((newAuthState) => {\n console.log('[useAuthState] Auth state changed:', newAuthState);\n setAuthState(newAuthState);\n });\n\n return () => {\n unsubscribe?.();\n };\n }, [instance]);\n\n return [authState, setAuthState, subscribeToAuthState];\n}"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAsC,iBAU/B,SAASF,EACdG,EAKA,CACA,KAAM,CAACC,EAAWC,CAAY,KAAI,YAChCF,GAAU,UAAU,mBAAqB,IAC3C,EAEMG,KAAuB,eAAY,IAAM,CAC7C,GAAI,CAACH,GAAU,UAAY,CAACA,EAAS,OACnC,MAAO,IAAM,CAAC,EAIhB,MAAMI,EAAuBJ,EAAS,SAAS,kBAC/CE,EAAaE,CAAoB,EAGjC,MAAMC,EAAcL,EAAS,OAAO,mBAAoBM,GAAiB,CACvE,QAAQ,IAAI,qCAAsCA,CAAY,EAC9DJ,EAAaI,CAAY,CAC3B,CAAC,EAED,MAAO,IAAM,CACXD,IAAc,CAChB,CACF,EAAG,CAACL,CAAQ,CAAC,EAEb,MAAO,CAACC,EAAWC,EAAcC,CAAoB,CACvD","names":["useAuthState_exports","__export","useAuthState","__toCommonJS","import_react","instance","authState","setAuthState","subscribeToAuthState","currentInternalState","unsubscribe","newAuthState"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useState as a,useCallback as c}from"react";function s(t){const[u,e]=a(t?.ternAuth?.internalAuthState||null),n=c(()=>{if(!t?.ternAuth||!t.events)return()=>{};const o=t.ternAuth.internalAuthState;e(o);const S=t.events.onAuthStateChanged(r=>{console.log("[useAuthState] Auth state changed:",r),e(r)});return()=>{S?.()}},[t]);return[u,e,n]}export{s as useAuthState};
|
|
2
|
-
//# sourceMappingURL=useAuthState.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useAuthState.tsx"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport type { IsomorphicTernSecure } from '../lib/isomorphicTernSecure';\nimport type { TernSecureState, DEFAULT_TERN_SECURE_STATE } from '@tern-secure/types';\nimport type React from 'react';\n\n/**\n * Custom hook that manages auth state and provides subscription callback.\n * @param instance The IsomorphicTernSecure instance\n * @returns Tuple containing [authState, setAuthState, subscribeToAuthState]\n */\nexport function useAuthState(\n instance: IsomorphicTernSecure | null\n): [\n TernSecureState | null, \n React.Dispatch<React.SetStateAction<TernSecureState | null>>,\n () => () => void\n] {\n const [authState, setAuthState] = useState<TernSecureState | null>(\n instance?.ternAuth?.internalAuthState || null\n );\n\n const subscribeToAuthState = useCallback(() => {\n if (!instance?.ternAuth || !instance.events) {\n return () => {}; // Return no-op cleanup function\n }\n\n // Set initial state\n const currentInternalState = instance.ternAuth.internalAuthState;\n setAuthState(currentInternalState);\n\n // Subscribe to changes\n const unsubscribe = instance.events.onAuthStateChanged((newAuthState) => {\n console.log('[useAuthState] Auth state changed:', newAuthState);\n setAuthState(newAuthState);\n });\n\n return () => {\n unsubscribe?.();\n };\n }, [instance]);\n\n return [authState, setAuthState, subscribeToAuthState];\n}"],"mappings":"AAAA,OAAS,YAAAA,EAAU,eAAAC,MAAmB,QAU/B,SAASC,EACdC,EAKA,CACA,KAAM,CAACC,EAAWC,CAAY,EAAIL,EAChCG,GAAU,UAAU,mBAAqB,IAC3C,EAEMG,EAAuBL,EAAY,IAAM,CAC7C,GAAI,CAACE,GAAU,UAAY,CAACA,EAAS,OACnC,MAAO,IAAM,CAAC,EAIhB,MAAMI,EAAuBJ,EAAS,SAAS,kBAC/CE,EAAaE,CAAoB,EAGjC,MAAMC,EAAcL,EAAS,OAAO,mBAAoBM,GAAiB,CACvE,QAAQ,IAAI,qCAAsCA,CAAY,EAC9DJ,EAAaI,CAAY,CAC3B,CAAC,EAED,MAAO,IAAM,CACXD,IAAc,CAChB,CACF,EAAG,CAACL,CAAQ,CAAC,EAEb,MAAO,CAACC,EAAWC,EAAcC,CAAoB,CACvD","names":["useState","useCallback","useAuthState","instance","authState","setAuthState","subscribeToAuthState","currentInternalState","unsubscribe","newAuthState"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
|
|
3
|
-
declare function useMaxAllowedInstancesGuard(name: string, error: string, maxCount?: number): void;
|
|
4
|
-
declare function withMaxAllowedInstancesGuard<P>(WrappedComponent: React__default.ComponentType<P>, name: string, error: string): React__default.ComponentType<P>;
|
|
5
|
-
|
|
6
|
-
export { useMaxAllowedInstancesGuard, withMaxAllowedInstancesGuard };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
|
|
3
|
-
declare function useMaxAllowedInstancesGuard(name: string, error: string, maxCount?: number): void;
|
|
4
|
-
declare function withMaxAllowedInstancesGuard<P>(WrappedComponent: React__default.ComponentType<P>, name: string, error: string): React__default.ComponentType<P>;
|
|
5
|
-
|
|
6
|
-
export { useMaxAllowedInstancesGuard, withMaxAllowedInstancesGuard };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var f=Object.create;var r=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var M=(t,n)=>{for(var e in n)r(t,e,{get:n[e],enumerable:!0})},a=(t,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of g(n))!y.call(t,s)&&s!==e&&r(t,s,{get:()=>n[s],enumerable:!(o=w(n,s))||o.enumerable});return t};var h=(t,n,e)=>(e=t!=null?f(p(t)):{},a(n||!t||!t.__esModule?r(e,"default",{value:t,enumerable:!0}):e,t)),m=t=>a(r({},"__esModule",{value:!0}),t);var P={};M(P,{useMaxAllowedInstancesGuard:()=>u,withMaxAllowedInstancesGuard:()=>x});module.exports=m(P);var d=require("react/jsx-runtime"),i=h(require("react"));const c=new Map;function u(t,n,e=1){i.default.useEffect(()=>{const o=c.get(t)||0;if(o==e)throw new Error(`Maximum number of instances (${e}) of ${t} reached. ${n}`);return c.set(t,o+1),()=>{c.set(t,(c.get(t)||1)-1)}},[])}function x(t,n,e){const o=t.displayName||t.name||n||"Component",s=l=>(u(n,e),(0,d.jsx)(t,{...l}));return s.displayName=`withMaxAllowedInstancesGuard(${o})`,s}0&&(module.exports={useMaxAllowedInstancesGuard,withMaxAllowedInstancesGuard});
|
|
2
|
-
//# sourceMappingURL=useMaxAllowedInstances.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useMaxAllowedInstances.tsx"],"sourcesContent":["import React from 'react';\n\nconst counts = new Map<string, number>();\n\nexport function useMaxAllowedInstancesGuard(name: string, error: string, maxCount = 1): void {\n React.useEffect(() => {\n const count = counts.get(name) || 0;\n if (count == maxCount) {\n throw new Error(\n `Maximum number of instances (${maxCount}) of ${name} reached. ${error}`,\n );\n }\n counts.set(name, count + 1);\n\n return () => {\n counts.set(name, (counts.get(name) || 1) - 1);\n };\n }, []);\n}\n\nexport function withMaxAllowedInstancesGuard<P>(\n WrappedComponent: React.ComponentType<P>,\n name: string,\n error: string,\n): React.ComponentType<P> {\n const displayName = WrappedComponent.displayName || WrappedComponent.name || name || 'Component';\n const Hoc = (props: P) => {\n useMaxAllowedInstancesGuard(name, error);\n return <WrappedComponent {...(props as any)} />;\n };\n Hoc.displayName = `withMaxAllowedInstancesGuard(${displayName})`;\n return Hoc;\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,EAAA,iCAAAC,IAAA,eAAAC,EAAAJ,GA4BW,IAAAK,EAAA,6BA5BXC,EAAkB,oBAElB,MAAMC,EAAS,IAAI,IAEZ,SAASL,EAA4BM,EAAcC,EAAeC,EAAW,EAAS,CAC3F,EAAAC,QAAM,UAAU,IAAM,CACpB,MAAMC,EAAQL,EAAO,IAAIC,CAAI,GAAK,EAClC,GAAII,GAASF,EACT,MAAM,IAAI,MACN,gCAAgCA,CAAQ,QAAQF,CAAI,aAAaC,CAAK,EAC1E,EAEJ,OAAAF,EAAO,IAAIC,EAAMI,EAAQ,CAAC,EAEnB,IAAM,CACXL,EAAO,IAAIC,GAAOD,EAAO,IAAIC,CAAI,GAAK,GAAK,CAAC,CAC9C,CACF,EAAG,CAAC,CAAC,CACP,CAEO,SAASL,EACdU,EACAL,EACAC,EACwB,CACxB,MAAMK,EAAcD,EAAiB,aAAeA,EAAiB,MAAQL,GAAQ,YAC/EO,EAAOC,IACXd,EAA4BM,EAAMC,CAAK,KAChC,OAACI,EAAA,CAAkB,GAAIG,EAAe,GAE/C,OAAAD,EAAI,YAAc,gCAAgCD,CAAW,IACtDC,CACT","names":["useMaxAllowedInstances_exports","__export","useMaxAllowedInstancesGuard","withMaxAllowedInstancesGuard","__toCommonJS","import_jsx_runtime","import_react","counts","name","error","maxCount","React","count","WrappedComponent","displayName","Hoc","props"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as u}from"react/jsx-runtime";import a from"react";const o=new Map;function i(t,n,e=1){a.useEffect(()=>{const s=o.get(t)||0;if(s==e)throw new Error(`Maximum number of instances (${e}) of ${t} reached. ${n}`);return o.set(t,s+1),()=>{o.set(t,(o.get(t)||1)-1)}},[])}function l(t,n,e){const s=t.displayName||t.name||n||"Component",r=c=>(i(n,e),u(t,{...c}));return r.displayName=`withMaxAllowedInstancesGuard(${s})`,r}export{i as useMaxAllowedInstancesGuard,l as withMaxAllowedInstancesGuard};
|
|
2
|
-
//# sourceMappingURL=useMaxAllowedInstances.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useMaxAllowedInstances.tsx"],"sourcesContent":["import React from 'react';\n\nconst counts = new Map<string, number>();\n\nexport function useMaxAllowedInstancesGuard(name: string, error: string, maxCount = 1): void {\n React.useEffect(() => {\n const count = counts.get(name) || 0;\n if (count == maxCount) {\n throw new Error(\n `Maximum number of instances (${maxCount}) of ${name} reached. ${error}`,\n );\n }\n counts.set(name, count + 1);\n\n return () => {\n counts.set(name, (counts.get(name) || 1) - 1);\n };\n }, []);\n}\n\nexport function withMaxAllowedInstancesGuard<P>(\n WrappedComponent: React.ComponentType<P>,\n name: string,\n error: string,\n): React.ComponentType<P> {\n const displayName = WrappedComponent.displayName || WrappedComponent.name || name || 'Component';\n const Hoc = (props: P) => {\n useMaxAllowedInstancesGuard(name, error);\n return <WrappedComponent {...(props as any)} />;\n };\n Hoc.displayName = `withMaxAllowedInstancesGuard(${displayName})`;\n return Hoc;\n}\n"],"mappings":"AA4BW,cAAAA,MAAA,oBA5BX,OAAOC,MAAW,QAElB,MAAMC,EAAS,IAAI,IAEZ,SAASC,EAA4BC,EAAcC,EAAeC,EAAW,EAAS,CAC3FL,EAAM,UAAU,IAAM,CACpB,MAAMM,EAAQL,EAAO,IAAIE,CAAI,GAAK,EAClC,GAAIG,GAASD,EACT,MAAM,IAAI,MACN,gCAAgCA,CAAQ,QAAQF,CAAI,aAAaC,CAAK,EAC1E,EAEJ,OAAAH,EAAO,IAAIE,EAAMG,EAAQ,CAAC,EAEnB,IAAM,CACXL,EAAO,IAAIE,GAAOF,EAAO,IAAIE,CAAI,GAAK,GAAK,CAAC,CAC9C,CACF,EAAG,CAAC,CAAC,CACP,CAEO,SAASI,EACdC,EACAL,EACAC,EACwB,CACxB,MAAMK,EAAcD,EAAiB,aAAeA,EAAiB,MAAQL,GAAQ,YAC/EO,EAAOC,IACXT,EAA4BC,EAAMC,CAAK,EAChCL,EAACS,EAAA,CAAkB,GAAIG,EAAe,GAE/C,OAAAD,EAAI,YAAc,gCAAgCD,CAAW,IACtDC,CACT","names":["jsx","React","counts","useMaxAllowedInstancesGuard","name","error","maxCount","count","withMaxAllowedInstancesGuard","WrappedComponent","displayName","Hoc","props"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SignInResponse } from '@tern-secure/types';
|
|
2
|
-
|
|
3
|
-
interface UseSignUpReturn {
|
|
4
|
-
email: string | null;
|
|
5
|
-
isLoading: boolean;
|
|
6
|
-
error: Error | null;
|
|
7
|
-
setEmail: (email: string) => void;
|
|
8
|
-
signUp: (email: string, password: string) => Promise<SignInResponse>;
|
|
9
|
-
resetState: () => void;
|
|
10
|
-
}
|
|
11
|
-
declare function useSignUp(): UseSignUpReturn;
|
|
12
|
-
|
|
13
|
-
export { type UseSignUpReturn, useSignUp };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SignInResponse } from '@tern-secure/types';
|
|
2
|
-
|
|
3
|
-
interface UseSignUpReturn {
|
|
4
|
-
email: string | null;
|
|
5
|
-
isLoading: boolean;
|
|
6
|
-
error: Error | null;
|
|
7
|
-
setEmail: (email: string) => void;
|
|
8
|
-
signUp: (email: string, password: string) => Promise<SignInResponse>;
|
|
9
|
-
resetState: () => void;
|
|
10
|
-
}
|
|
11
|
-
declare function useSignUp(): UseSignUpReturn;
|
|
12
|
-
|
|
13
|
-
export { type UseSignUpReturn, useSignUp };
|
package/dist/hooks/useSignUp.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";"use client";var l=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var h=(e,r)=>{for(var s in r)l(e,s,{get:r[s],enumerable:!0})},y=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of E(r))!U.call(e,n)&&n!==s&&l(e,n,{get:()=>r[n],enumerable:!(i=S(r,n))||i.enumerable});return e};var w=e=>y(l({},"__esModule",{value:!0}),e);var R={};h(R,{useSignUp:()=>I});module.exports=w(R);var t=require("react"),c=require("@tern-secure/shared/react");function I(){const e=(0,c.useTernSecure)(),[r,s]=(0,t.useState)(!1),[i,n]=(0,t.useState)(null),[g,a]=(0,t.useState)(e.auth.user?.email??null),m=(0,t.useCallback)(()=>{s(!1),n(null),a(null)},[]),p=(0,t.useCallback)(async(f,d)=>{s(!0),n(null);try{return await e.ternAuth.signInWithEmailAndPassword(f,d)}catch(u){const o=u instanceof Error?u:new Error("Failed to create account");return n(o),{success:!1,message:o.message,error:o,user:null}}finally{s(!1)}},[e.ternAuth]);return{email:g,isLoading:r,error:i,setEmail:a,signUp:p,resetState:m}}0&&(module.exports={useSignUp});
|
|
2
|
-
//# sourceMappingURL=useSignUp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useSignUp.ts"],"sourcesContent":["\"use client\"\r\n\r\nimport { useState, useCallback } from 'react'\r\nimport { useTernSecure } from '@tern-secure/shared/react'\r\nimport type { SignInResponse } from '@tern-secure/types'\r\n\r\nexport interface UseSignUpReturn {\r\n email: string | null\r\n isLoading: boolean\r\n error: Error | null\r\n setEmail: (email: string) => void\r\n signUp: (email: string, password: string) => Promise<SignInResponse>\r\n resetState: () => void\r\n}\r\n\r\nexport function useSignUp(): UseSignUpReturn {\r\n const instance = useTernSecure()\r\n const [isLoading, setIsLoading] = useState(false)\r\n const [error, setError] = useState<Error | null>(null)\r\n const [email, setEmail] = useState<string | null>(instance.auth.user?.email ?? null)\r\n\r\n const resetState = useCallback(() => {\r\n setIsLoading(false)\r\n setError(null)\r\n setEmail(null)\r\n }, [])\r\n\r\n const signUp = useCallback(async (email: string, password: string) => {\r\n setIsLoading(true)\r\n setError(null)\r\n try {\r\n return await instance.ternAuth.signInWithEmailAndPassword(email, password)\r\n } catch (err) {\r\n const error = err instanceof Error ? err : new Error('Failed to create account')\r\n setError(error)\r\n return {\r\n success: false,\r\n message: error.message,\r\n error: error,\r\n user: null\r\n }\r\n } finally {\r\n setIsLoading(false)\r\n }\r\n }, [instance.ternAuth])\r\n\r\n return {\r\n email,\r\n isLoading,\r\n error,\r\n setEmail,\r\n signUp,\r\n resetState\r\n }\r\n}\r\n"],"mappings":"sbAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAsC,iBACtCA,EAA8B,qCAYvB,SAASF,GAA6B,CAC3C,MAAMG,KAAW,iBAAc,EACzB,CAACC,EAAWC,CAAY,KAAI,YAAS,EAAK,EAC1C,CAACC,EAAOC,CAAQ,KAAI,YAAuB,IAAI,EAC/C,CAACC,EAAOC,CAAQ,KAAI,YAAwBN,EAAS,KAAK,MAAM,OAAS,IAAI,EAE7EO,KAAa,eAAY,IAAM,CACnCL,EAAa,EAAK,EAClBE,EAAS,IAAI,EACbE,EAAS,IAAI,CACf,EAAG,CAAC,CAAC,EAECE,KAAS,eAAY,MAAOH,EAAeI,IAAqB,CACpEP,EAAa,EAAI,EACjBE,EAAS,IAAI,EACb,GAAI,CACF,OAAO,MAAMJ,EAAS,SAAS,2BAA2BK,EAAOI,CAAQ,CAC3E,OAASC,EAAK,CACZ,MAAMP,EAAQO,aAAe,MAAQA,EAAM,IAAI,MAAM,0BAA0B,EAC/E,OAAAN,EAASD,CAAK,EACP,CACL,QAAS,GACT,QAASA,EAAM,QACf,MAAOA,EACP,KAAM,IACR,CACF,QAAE,CACAD,EAAa,EAAK,CACpB,CACF,EAAG,CAACF,EAAS,QAAQ,CAAC,EAEtB,MAAO,CACL,MAAAK,EACA,UAAAJ,EACA,MAAAE,EACA,SAAAG,EACA,OAAAE,EACA,WAAAD,CACF,CACF","names":["useSignUp_exports","__export","useSignUp","__toCommonJS","import_react","instance","isLoading","setIsLoading","error","setError","email","setEmail","resetState","signUp","password","err"]}
|
package/dist/hooks/useSignUp.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";import{useState as t,useCallback as l}from"react";import{useTernSecure as d}from"@tern-secure/shared/react";function U(){const e=d(),[a,r]=t(!1),[u,n]=t(null),[c,i]=t(e.auth.user?.email??null),g=l(()=>{r(!1),n(null),i(null)},[]),m=l(async(p,f)=>{r(!0),n(null);try{return await e.ternAuth.signInWithEmailAndPassword(p,f)}catch(o){const s=o instanceof Error?o:new Error("Failed to create account");return n(s),{success:!1,message:s.message,error:s,user:null}}finally{r(!1)}},[e.ternAuth]);return{email:c,isLoading:a,error:u,setEmail:i,signUp:m,resetState:g}}export{U as useSignUp};
|
|
2
|
-
//# sourceMappingURL=useSignUp.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useSignUp.ts"],"sourcesContent":["\"use client\"\r\n\r\nimport { useState, useCallback } from 'react'\r\nimport { useTernSecure } from '@tern-secure/shared/react'\r\nimport type { SignInResponse } from '@tern-secure/types'\r\n\r\nexport interface UseSignUpReturn {\r\n email: string | null\r\n isLoading: boolean\r\n error: Error | null\r\n setEmail: (email: string) => void\r\n signUp: (email: string, password: string) => Promise<SignInResponse>\r\n resetState: () => void\r\n}\r\n\r\nexport function useSignUp(): UseSignUpReturn {\r\n const instance = useTernSecure()\r\n const [isLoading, setIsLoading] = useState(false)\r\n const [error, setError] = useState<Error | null>(null)\r\n const [email, setEmail] = useState<string | null>(instance.auth.user?.email ?? null)\r\n\r\n const resetState = useCallback(() => {\r\n setIsLoading(false)\r\n setError(null)\r\n setEmail(null)\r\n }, [])\r\n\r\n const signUp = useCallback(async (email: string, password: string) => {\r\n setIsLoading(true)\r\n setError(null)\r\n try {\r\n return await instance.ternAuth.signInWithEmailAndPassword(email, password)\r\n } catch (err) {\r\n const error = err instanceof Error ? err : new Error('Failed to create account')\r\n setError(error)\r\n return {\r\n success: false,\r\n message: error.message,\r\n error: error,\r\n user: null\r\n }\r\n } finally {\r\n setIsLoading(false)\r\n }\r\n }, [instance.ternAuth])\r\n\r\n return {\r\n email,\r\n isLoading,\r\n error,\r\n setEmail,\r\n signUp,\r\n resetState\r\n }\r\n}\r\n"],"mappings":"aAEA,OAAS,YAAAA,EAAU,eAAAC,MAAmB,QACtC,OAAS,iBAAAC,MAAqB,4BAYvB,SAASC,GAA6B,CAC3C,MAAMC,EAAWF,EAAc,EACzB,CAACG,EAAWC,CAAY,EAAIN,EAAS,EAAK,EAC1C,CAACO,EAAOC,CAAQ,EAAIR,EAAuB,IAAI,EAC/C,CAACS,EAAOC,CAAQ,EAAIV,EAAwBI,EAAS,KAAK,MAAM,OAAS,IAAI,EAE7EO,EAAaV,EAAY,IAAM,CACnCK,EAAa,EAAK,EAClBE,EAAS,IAAI,EACbE,EAAS,IAAI,CACf,EAAG,CAAC,CAAC,EAECE,EAASX,EAAY,MAAOQ,EAAeI,IAAqB,CACpEP,EAAa,EAAI,EACjBE,EAAS,IAAI,EACb,GAAI,CACF,OAAO,MAAMJ,EAAS,SAAS,2BAA2BK,EAAOI,CAAQ,CAC3E,OAASC,EAAK,CACZ,MAAMP,EAAQO,aAAe,MAAQA,EAAM,IAAI,MAAM,0BAA0B,EAC/E,OAAAN,EAASD,CAAK,EACP,CACL,QAAS,GACT,QAASA,EAAM,QACf,MAAOA,EACP,KAAM,IACR,CACF,QAAE,CACAD,EAAa,EAAK,CACpB,CACF,EAAG,CAACF,EAAS,QAAQ,CAAC,EAEtB,MAAO,CACL,MAAAK,EACA,UAAAJ,EACA,MAAAE,EACA,SAAAG,EACA,OAAAE,EACA,WAAAD,CACF,CACF","names":["useState","useCallback","useTernSecure","useSignUp","instance","isLoading","setIsLoading","error","setError","email","setEmail","resetState","signUp","password","err"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type MountingStatus = 'rendering' | 'rendered' | 'error';
|
|
2
|
-
/**
|
|
3
|
-
* Detect when a TernSecure component has mounted by watching DOM updates
|
|
4
|
-
* to an element with a `data-ternsecure-component="${component}"` property.
|
|
5
|
-
*/
|
|
6
|
-
declare const useWaitForComponentMount: (component?: string) => MountingStatus;
|
|
7
|
-
|
|
8
|
-
export { useWaitForComponentMount };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type MountingStatus = 'rendering' | 'rendered' | 'error';
|
|
2
|
-
/**
|
|
3
|
-
* Detect when a TernSecure component has mounted by watching DOM updates
|
|
4
|
-
* to an element with a `data-ternsecure-component="${component}"` property.
|
|
5
|
-
*/
|
|
6
|
-
declare const useWaitForComponentMount: (component?: string) => MountingStatus;
|
|
7
|
-
|
|
8
|
-
export { useWaitForComponentMount };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},p=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of a(e))!E.call(t,o)&&o!==r&&s(t,o,{get:()=>e[o],enumerable:!(n=f(e,o))||n.enumerable});return t};var g=t=>p(s({},"__esModule",{value:!0}),t);var b={};h(b,{useWaitForComponentMount:()=>S});module.exports=g(b);var u=require("react");function w(t){const{root:e=document?.body,selector:r,timeout:n=0}=t;return new Promise((o,d)=>{if(!e){d(new Error("No root element provided"));return}let i=e;if(r&&(i=e?.querySelector(r)),i?.childElementCount&&i.childElementCount>0){o();return}const c=new MutationObserver(l=>{for(const m of l)if(m.type==="childList"&&(!i&&r&&(i=e?.querySelector(r)),i?.childElementCount&&i.childElementCount>0)){c.disconnect(),o();return}});c.observe(e,{childList:!0,subtree:!0}),n>0&&setTimeout(()=>{c.disconnect(),d(new Error(`Timeout waiting for element children after ${n}ms`))},n)})}const S=t=>{const e=(0,u.useRef)(void 0),[r,n]=(0,u.useState)("rendering");return(0,u.useEffect)(()=>{if(!t){console.error("TernSecure: no component name provided, unable to detect mount."),n("error");return}typeof window<"u"&&!e.current&&(e.current=w({selector:`[data-ternsecure-component="${t}"]`,timeout:1e4}).then(()=>{n("rendered")}).catch(o=>{console.error("TernSecure: Error detecting component mount:",o),n("error")}))},[t]),r};0&&(module.exports={useWaitForComponentMount});
|
|
2
|
-
//# sourceMappingURL=useWaitForComponentMount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useWaitForComponentMount.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\ninterface WaitForElementOptions {\n selector?: string;\n root?: HTMLElement | null;\n timeout?: number;\n}\n\n/**\n * Waits for an element to have children in the DOM.\n * Used to detect when a TernSecure component has been fully mounted.\n */\nfunction waitForElementChildren(options: WaitForElementOptions): Promise<void> {\n const { root = document?.body, selector, timeout = 0 } = options;\n\n return new Promise<void>((resolve, reject) => {\n if (!root) {\n reject(new Error('No root element provided'));\n return;\n }\n\n let elementToWatch: HTMLElement | null = root;\n if (selector) {\n elementToWatch = root?.querySelector(selector);\n }\n\n // Check if element already has children\n if (elementToWatch?.childElementCount && elementToWatch.childElementCount > 0) {\n resolve();\n return;\n }\n\n // Set up MutationObserver to watch for children\n const observer = new MutationObserver(mutations => {\n for (const mutation of mutations) {\n if (mutation.type === 'childList') {\n if (!elementToWatch && selector) {\n elementToWatch = root?.querySelector(selector);\n }\n\n if (elementToWatch?.childElementCount && elementToWatch.childElementCount > 0) {\n observer.disconnect();\n resolve();\n return;\n }\n }\n }\n });\n\n observer.observe(root, { childList: true, subtree: true });\n\n // Optional timeout\n if (timeout > 0) {\n setTimeout(() => {\n observer.disconnect();\n reject(new Error(`Timeout waiting for element children after ${timeout}ms`));\n }, timeout);\n }\n });\n}\n\ntype MountingStatus = 'rendering' | 'rendered' | 'error';\n\n/**\n * Detect when a TernSecure component has mounted by watching DOM updates\n * to an element with a `data-ternsecure-component=\"${component}\"` property.\n */\nexport const useWaitForComponentMount = (component?: string): MountingStatus => {\n const watcherRef = useRef<Promise<void> | undefined>(undefined);\n const [status, setStatus] = useState<MountingStatus>('rendering');\n\n useEffect(() => {\n if (!component) {\n console.error('TernSecure: no component name provided, unable to detect mount.');\n setStatus('error');\n return;\n }\n\n if (typeof window !== 'undefined' && !watcherRef.current) {\n watcherRef.current = waitForElementChildren({ \n selector: `[data-ternsecure-component=\"${component}\"]`,\n timeout: 10000 // 10 second timeout\n })\n .then(() => {\n setStatus('rendered');\n })\n .catch((error) => {\n console.error('TernSecure: Error detecting component mount:', error);\n setStatus('error');\n });\n }\n }, [component]);\n\n return status;\n};\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4C,iBAY5C,SAASC,EAAuBC,EAA+C,CAC7E,KAAM,CAAE,KAAAC,EAAO,UAAU,KAAM,SAAAC,EAAU,QAAAC,EAAU,CAAE,EAAIH,EAEzD,OAAO,IAAI,QAAc,CAACI,EAASC,IAAW,CAC5C,GAAI,CAACJ,EAAM,CACTI,EAAO,IAAI,MAAM,0BAA0B,CAAC,EAC5C,MACF,CAEA,IAAIC,EAAqCL,EAMzC,GALIC,IACFI,EAAiBL,GAAM,cAAcC,CAAQ,GAI3CI,GAAgB,mBAAqBA,EAAe,kBAAoB,EAAG,CAC7EF,EAAQ,EACR,MACF,CAGA,MAAMG,EAAW,IAAI,iBAAiBC,GAAa,CACjD,UAAWC,KAAYD,EACrB,GAAIC,EAAS,OAAS,cAChB,CAACH,GAAkBJ,IACrBI,EAAiBL,GAAM,cAAcC,CAAQ,GAG3CI,GAAgB,mBAAqBA,EAAe,kBAAoB,GAAG,CAC7EC,EAAS,WAAW,EACpBH,EAAQ,EACR,MACF,CAGN,CAAC,EAEDG,EAAS,QAAQN,EAAM,CAAE,UAAW,GAAM,QAAS,EAAK,CAAC,EAGrDE,EAAU,GACZ,WAAW,IAAM,CACfI,EAAS,WAAW,EACpBF,EAAO,IAAI,MAAM,8CAA8CF,CAAO,IAAI,CAAC,CAC7E,EAAGA,CAAO,CAEd,CAAC,CACH,CAQO,MAAMP,EAA4Bc,GAAuC,CAC9E,MAAMC,KAAa,UAAkC,MAAS,EACxD,CAACC,EAAQC,CAAS,KAAI,YAAyB,WAAW,EAEhE,sBAAU,IAAM,CACd,GAAI,CAACH,EAAW,CACd,QAAQ,MAAM,iEAAiE,EAC/EG,EAAU,OAAO,EACjB,MACF,CAEI,OAAO,OAAW,KAAe,CAACF,EAAW,UAC/CA,EAAW,QAAUZ,EAAuB,CAC1C,SAAU,+BAA+BW,CAAS,KAClD,QAAS,GACX,CAAC,EACE,KAAK,IAAM,CACVG,EAAU,UAAU,CACtB,CAAC,EACA,MAAOC,GAAU,CAChB,QAAQ,MAAM,+CAAgDA,CAAK,EACnED,EAAU,OAAO,CACnB,CAAC,EAEP,EAAG,CAACH,CAAS,CAAC,EAEPE,CACT","names":["useWaitForComponentMount_exports","__export","useWaitForComponentMount","__toCommonJS","import_react","waitForElementChildren","options","root","selector","timeout","resolve","reject","elementToWatch","observer","mutations","mutation","component","watcherRef","status","setStatus","error"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useEffect as l,useRef as m,useState as f}from"react";function a(o){const{root:e=document?.body,selector:n,timeout:t=0}=o;return new Promise((i,c)=>{if(!e){c(new Error("No root element provided"));return}let r=e;if(n&&(r=e?.querySelector(n)),r?.childElementCount&&r.childElementCount>0){i();return}const u=new MutationObserver(s=>{for(const d of s)if(d.type==="childList"&&(!r&&n&&(r=e?.querySelector(n)),r?.childElementCount&&r.childElementCount>0)){u.disconnect(),i();return}});u.observe(e,{childList:!0,subtree:!0}),t>0&&setTimeout(()=>{u.disconnect(),c(new Error(`Timeout waiting for element children after ${t}ms`))},t)})}const h=o=>{const e=m(void 0),[n,t]=f("rendering");return l(()=>{if(!o){console.error("TernSecure: no component name provided, unable to detect mount."),t("error");return}typeof window<"u"&&!e.current&&(e.current=a({selector:`[data-ternsecure-component="${o}"]`,timeout:1e4}).then(()=>{t("rendered")}).catch(i=>{console.error("TernSecure: Error detecting component mount:",i),t("error")}))},[o]),n};export{h as useWaitForComponentMount};
|
|
2
|
-
//# sourceMappingURL=useWaitForComponentMount.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useWaitForComponentMount.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\ninterface WaitForElementOptions {\n selector?: string;\n root?: HTMLElement | null;\n timeout?: number;\n}\n\n/**\n * Waits for an element to have children in the DOM.\n * Used to detect when a TernSecure component has been fully mounted.\n */\nfunction waitForElementChildren(options: WaitForElementOptions): Promise<void> {\n const { root = document?.body, selector, timeout = 0 } = options;\n\n return new Promise<void>((resolve, reject) => {\n if (!root) {\n reject(new Error('No root element provided'));\n return;\n }\n\n let elementToWatch: HTMLElement | null = root;\n if (selector) {\n elementToWatch = root?.querySelector(selector);\n }\n\n // Check if element already has children\n if (elementToWatch?.childElementCount && elementToWatch.childElementCount > 0) {\n resolve();\n return;\n }\n\n // Set up MutationObserver to watch for children\n const observer = new MutationObserver(mutations => {\n for (const mutation of mutations) {\n if (mutation.type === 'childList') {\n if (!elementToWatch && selector) {\n elementToWatch = root?.querySelector(selector);\n }\n\n if (elementToWatch?.childElementCount && elementToWatch.childElementCount > 0) {\n observer.disconnect();\n resolve();\n return;\n }\n }\n }\n });\n\n observer.observe(root, { childList: true, subtree: true });\n\n // Optional timeout\n if (timeout > 0) {\n setTimeout(() => {\n observer.disconnect();\n reject(new Error(`Timeout waiting for element children after ${timeout}ms`));\n }, timeout);\n }\n });\n}\n\ntype MountingStatus = 'rendering' | 'rendered' | 'error';\n\n/**\n * Detect when a TernSecure component has mounted by watching DOM updates\n * to an element with a `data-ternsecure-component=\"${component}\"` property.\n */\nexport const useWaitForComponentMount = (component?: string): MountingStatus => {\n const watcherRef = useRef<Promise<void> | undefined>(undefined);\n const [status, setStatus] = useState<MountingStatus>('rendering');\n\n useEffect(() => {\n if (!component) {\n console.error('TernSecure: no component name provided, unable to detect mount.');\n setStatus('error');\n return;\n }\n\n if (typeof window !== 'undefined' && !watcherRef.current) {\n watcherRef.current = waitForElementChildren({ \n selector: `[data-ternsecure-component=\"${component}\"]`,\n timeout: 10000 // 10 second timeout\n })\n .then(() => {\n setStatus('rendered');\n })\n .catch((error) => {\n console.error('TernSecure: Error detecting component mount:', error);\n setStatus('error');\n });\n }\n }, [component]);\n\n return status;\n};\n"],"mappings":"AAAA,OAAS,aAAAA,EAAW,UAAAC,EAAQ,YAAAC,MAAgB,QAY5C,SAASC,EAAuBC,EAA+C,CAC7E,KAAM,CAAE,KAAAC,EAAO,UAAU,KAAM,SAAAC,EAAU,QAAAC,EAAU,CAAE,EAAIH,EAEzD,OAAO,IAAI,QAAc,CAACI,EAASC,IAAW,CAC5C,GAAI,CAACJ,EAAM,CACTI,EAAO,IAAI,MAAM,0BAA0B,CAAC,EAC5C,MACF,CAEA,IAAIC,EAAqCL,EAMzC,GALIC,IACFI,EAAiBL,GAAM,cAAcC,CAAQ,GAI3CI,GAAgB,mBAAqBA,EAAe,kBAAoB,EAAG,CAC7EF,EAAQ,EACR,MACF,CAGA,MAAMG,EAAW,IAAI,iBAAiBC,GAAa,CACjD,UAAWC,KAAYD,EACrB,GAAIC,EAAS,OAAS,cAChB,CAACH,GAAkBJ,IACrBI,EAAiBL,GAAM,cAAcC,CAAQ,GAG3CI,GAAgB,mBAAqBA,EAAe,kBAAoB,GAAG,CAC7EC,EAAS,WAAW,EACpBH,EAAQ,EACR,MACF,CAGN,CAAC,EAEDG,EAAS,QAAQN,EAAM,CAAE,UAAW,GAAM,QAAS,EAAK,CAAC,EAGrDE,EAAU,GACZ,WAAW,IAAM,CACfI,EAAS,WAAW,EACpBF,EAAO,IAAI,MAAM,8CAA8CF,CAAO,IAAI,CAAC,CAC7E,EAAGA,CAAO,CAEd,CAAC,CACH,CAQO,MAAMO,EAA4BC,GAAuC,CAC9E,MAAMC,EAAaf,EAAkC,MAAS,EACxD,CAACgB,EAAQC,CAAS,EAAIhB,EAAyB,WAAW,EAEhE,OAAAF,EAAU,IAAM,CACd,GAAI,CAACe,EAAW,CACd,QAAQ,MAAM,iEAAiE,EAC/EG,EAAU,OAAO,EACjB,MACF,CAEI,OAAO,OAAW,KAAe,CAACF,EAAW,UAC/CA,EAAW,QAAUb,EAAuB,CAC1C,SAAU,+BAA+BY,CAAS,KAClD,QAAS,GACX,CAAC,EACE,KAAK,IAAM,CACVG,EAAU,UAAU,CACtB,CAAC,EACA,MAAOC,GAAU,CAChB,QAAQ,MAAM,+CAAgDA,CAAK,EACnED,EAAU,OAAO,CACnB,CAAC,EAEP,EAAG,CAACH,CAAS,CAAC,EAEPE,CACT","names":["useEffect","useRef","useState","waitForElementChildren","options","root","selector","timeout","resolve","reject","elementToWatch","observer","mutations","mutation","useWaitForComponentMount","component","watcherRef","status","setStatus","error"]}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import * as _tern_secure_types from '@tern-secure/types';
|
|
2
|
-
import { TernSecureInstanceTree, TernSecureInstanceTreeStatus, TernSecureAuthProvider, SignInPropsTree, SignUpPropsTree, SignInRedirectOptions, SignUpRedirectOptions } from '@tern-secure/types';
|
|
3
|
-
import { IsomorphicTernSecureOptions, HeadlessUIBrowser, Browser } from '../types.mjs';
|
|
4
|
-
|
|
5
|
-
interface Global {
|
|
6
|
-
TernSecure?: HeadlessUIBrowser | Browser;
|
|
7
|
-
}
|
|
8
|
-
declare function inBrowser(): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* IsomorphicTernSecure class manages the auth state and UI rendering
|
|
11
|
-
* in both browser and server environments
|
|
12
|
-
*/
|
|
13
|
-
declare class IsomorphicTernSecure implements TernSecureInstanceTree {
|
|
14
|
-
#private;
|
|
15
|
-
private readonly _mode;
|
|
16
|
-
private readonly options;
|
|
17
|
-
private readonly TernSecure;
|
|
18
|
-
private ternui;
|
|
19
|
-
private _authProvider?;
|
|
20
|
-
private premountState;
|
|
21
|
-
get isReady(): boolean;
|
|
22
|
-
get status(): TernSecureInstanceTreeStatus;
|
|
23
|
-
get isLoading(): boolean;
|
|
24
|
-
get error(): Error | null;
|
|
25
|
-
get requiresVerification(): boolean;
|
|
26
|
-
static getOrCreateInstance(options: IsomorphicTernSecureOptions): IsomorphicTernSecure;
|
|
27
|
-
static clearInstance(): void;
|
|
28
|
-
get customDomain(): string;
|
|
29
|
-
get proxyUrl(): string | undefined;
|
|
30
|
-
get apiKey(): string | undefined;
|
|
31
|
-
get projectId(): string | undefined;
|
|
32
|
-
get sdkMetadata(): _tern_secure_types.TernSecureSDK | undefined;
|
|
33
|
-
get version(): string | undefined;
|
|
34
|
-
get mode(): 'browser' | 'server' | undefined;
|
|
35
|
-
constructor(options: IsomorphicTernSecureOptions);
|
|
36
|
-
get auth(): TernSecureInstanceTree['auth'];
|
|
37
|
-
get isVisible(): boolean;
|
|
38
|
-
get currentView(): 'signIn' | 'signUp' | 'verify' | null;
|
|
39
|
-
get ternAuth(): TernSecureAuthProvider | undefined;
|
|
40
|
-
loadTernUI(): Promise<HeadlessUIBrowser | Browser | undefined>;
|
|
41
|
-
private beforeLoad;
|
|
42
|
-
private injectTernUI;
|
|
43
|
-
/**
|
|
44
|
-
* Subscribe to TernUI events and delegate status changes
|
|
45
|
-
*/
|
|
46
|
-
private subscribeToTernUIEvents;
|
|
47
|
-
initialize: (props: any) => Promise<void>;
|
|
48
|
-
showSignIn: (node: HTMLDivElement, config?: SignInPropsTree) => void;
|
|
49
|
-
hideSignIn: (node: HTMLDivElement) => void;
|
|
50
|
-
showSignUp: (node: HTMLDivElement, config?: SignUpPropsTree) => void;
|
|
51
|
-
hideSignUp: (node: HTMLDivElement) => void;
|
|
52
|
-
showUserButton: (node: HTMLDivElement) => void;
|
|
53
|
-
hideUserButton: (node: HTMLDivElement) => void;
|
|
54
|
-
clearError: () => void;
|
|
55
|
-
setLoading: (isLoading: boolean) => void;
|
|
56
|
-
getRedirectResult: () => Promise<any>;
|
|
57
|
-
shouldRedirect: (currentPath: string) => boolean | string;
|
|
58
|
-
constructUrlWithAuthRedirect: (baseUrl: string) => string;
|
|
59
|
-
redirectToSignIn: (options?: SignInRedirectOptions) => Promise<void>;
|
|
60
|
-
redirectToSignUp: (options?: SignUpRedirectOptions) => Promise<void>;
|
|
61
|
-
redirectAfterSignIn: (redirectUrl?: string) => void;
|
|
62
|
-
redirectAfterSignUp: (redirectUrl?: string) => void;
|
|
63
|
-
get events(): TernSecureInstanceTree['events'];
|
|
64
|
-
private queueMethodCall;
|
|
65
|
-
setAuthProvider(ternAuth: TernSecureAuthProvider): void;
|
|
66
|
-
/**
|
|
67
|
-
* Update the instance and process any queued operations
|
|
68
|
-
*/
|
|
69
|
-
__internal_updateInstance(instance: TernSecureInstanceTree): void;
|
|
70
|
-
}
|
|
71
|
-
declare function isConstructor<T>(f: any): f is T;
|
|
72
|
-
|
|
73
|
-
export { type Global, IsomorphicTernSecure, inBrowser, isConstructor };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import * as _tern_secure_types from '@tern-secure/types';
|
|
2
|
-
import { TernSecureInstanceTree, TernSecureInstanceTreeStatus, TernSecureAuthProvider, SignInPropsTree, SignUpPropsTree, SignInRedirectOptions, SignUpRedirectOptions } from '@tern-secure/types';
|
|
3
|
-
import { IsomorphicTernSecureOptions, HeadlessUIBrowser, Browser } from '../types.js';
|
|
4
|
-
|
|
5
|
-
interface Global {
|
|
6
|
-
TernSecure?: HeadlessUIBrowser | Browser;
|
|
7
|
-
}
|
|
8
|
-
declare function inBrowser(): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* IsomorphicTernSecure class manages the auth state and UI rendering
|
|
11
|
-
* in both browser and server environments
|
|
12
|
-
*/
|
|
13
|
-
declare class IsomorphicTernSecure implements TernSecureInstanceTree {
|
|
14
|
-
#private;
|
|
15
|
-
private readonly _mode;
|
|
16
|
-
private readonly options;
|
|
17
|
-
private readonly TernSecure;
|
|
18
|
-
private ternui;
|
|
19
|
-
private _authProvider?;
|
|
20
|
-
private premountState;
|
|
21
|
-
get isReady(): boolean;
|
|
22
|
-
get status(): TernSecureInstanceTreeStatus;
|
|
23
|
-
get isLoading(): boolean;
|
|
24
|
-
get error(): Error | null;
|
|
25
|
-
get requiresVerification(): boolean;
|
|
26
|
-
static getOrCreateInstance(options: IsomorphicTernSecureOptions): IsomorphicTernSecure;
|
|
27
|
-
static clearInstance(): void;
|
|
28
|
-
get customDomain(): string;
|
|
29
|
-
get proxyUrl(): string | undefined;
|
|
30
|
-
get apiKey(): string | undefined;
|
|
31
|
-
get projectId(): string | undefined;
|
|
32
|
-
get sdkMetadata(): _tern_secure_types.TernSecureSDK | undefined;
|
|
33
|
-
get version(): string | undefined;
|
|
34
|
-
get mode(): 'browser' | 'server' | undefined;
|
|
35
|
-
constructor(options: IsomorphicTernSecureOptions);
|
|
36
|
-
get auth(): TernSecureInstanceTree['auth'];
|
|
37
|
-
get isVisible(): boolean;
|
|
38
|
-
get currentView(): 'signIn' | 'signUp' | 'verify' | null;
|
|
39
|
-
get ternAuth(): TernSecureAuthProvider | undefined;
|
|
40
|
-
loadTernUI(): Promise<HeadlessUIBrowser | Browser | undefined>;
|
|
41
|
-
private beforeLoad;
|
|
42
|
-
private injectTernUI;
|
|
43
|
-
/**
|
|
44
|
-
* Subscribe to TernUI events and delegate status changes
|
|
45
|
-
*/
|
|
46
|
-
private subscribeToTernUIEvents;
|
|
47
|
-
initialize: (props: any) => Promise<void>;
|
|
48
|
-
showSignIn: (node: HTMLDivElement, config?: SignInPropsTree) => void;
|
|
49
|
-
hideSignIn: (node: HTMLDivElement) => void;
|
|
50
|
-
showSignUp: (node: HTMLDivElement, config?: SignUpPropsTree) => void;
|
|
51
|
-
hideSignUp: (node: HTMLDivElement) => void;
|
|
52
|
-
showUserButton: (node: HTMLDivElement) => void;
|
|
53
|
-
hideUserButton: (node: HTMLDivElement) => void;
|
|
54
|
-
clearError: () => void;
|
|
55
|
-
setLoading: (isLoading: boolean) => void;
|
|
56
|
-
getRedirectResult: () => Promise<any>;
|
|
57
|
-
shouldRedirect: (currentPath: string) => boolean | string;
|
|
58
|
-
constructUrlWithAuthRedirect: (baseUrl: string) => string;
|
|
59
|
-
redirectToSignIn: (options?: SignInRedirectOptions) => Promise<void>;
|
|
60
|
-
redirectToSignUp: (options?: SignUpRedirectOptions) => Promise<void>;
|
|
61
|
-
redirectAfterSignIn: (redirectUrl?: string) => void;
|
|
62
|
-
redirectAfterSignUp: (redirectUrl?: string) => void;
|
|
63
|
-
get events(): TernSecureInstanceTree['events'];
|
|
64
|
-
private queueMethodCall;
|
|
65
|
-
setAuthProvider(ternAuth: TernSecureAuthProvider): void;
|
|
66
|
-
/**
|
|
67
|
-
* Update the instance and process any queued operations
|
|
68
|
-
*/
|
|
69
|
-
__internal_updateInstance(instance: TernSecureInstanceTree): void;
|
|
70
|
-
}
|
|
71
|
-
declare function isConstructor<T>(f: any): f is T;
|
|
72
|
-
|
|
73
|
-
export { type Global, IsomorphicTernSecure, inBrowser, isConstructor };
|