@tern-secure/react 1.2.0-canary.v20251108045933 → 1.2.0-canary.v20251127221555
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/components/TernSecureHostRenderer.d.mts +24 -0
- package/dist/components/TernSecureHostRenderer.d.ts +24 -0
- package/dist/components/TernSecureHostRenderer.js +2 -0
- package/dist/components/TernSecureHostRenderer.js.map +1 -0
- package/dist/components/TernSecureHostRenderer.mjs +2 -0
- package/dist/components/TernSecureHostRenderer.mjs.map +1 -0
- package/dist/components/uiComponent.d.mts +30 -0
- package/dist/components/uiComponent.d.ts +30 -0
- package/dist/components/uiComponent.js +2 -0
- package/dist/components/uiComponent.js.map +1 -0
- package/dist/components/uiComponent.mjs +2 -0
- package/dist/components/uiComponent.mjs.map +1 -0
- package/dist/components/withTernSecure.d.mts +16 -0
- package/dist/components/withTernSecure.d.ts +16 -0
- package/dist/components/withTernSecure.js +2 -0
- package/dist/components/withTernSecure.js.map +1 -0
- package/dist/components/withTernSecure.mjs +2 -0
- package/dist/components/withTernSecure.mjs.map +1 -0
- package/dist/ctx/AuthProvider.d.mts +2 -2
- package/dist/ctx/AuthProvider.d.ts +2 -2
- package/dist/ctx/IsomorphicTernSecureCtx.d.mts +2 -2
- package/dist/ctx/IsomorphicTernSecureCtx.d.ts +2 -2
- package/dist/ctx/TernSecureCtxProvider.d.mts +2 -2
- package/dist/ctx/TernSecureCtxProvider.d.ts +2 -2
- 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.d.mts +2 -2
- package/dist/ctx/TernSecureProvider.d.ts +2 -2
- package/dist/hooks/useAppCheck.d.mts +11 -0
- package/dist/hooks/useAppCheck.d.ts +11 -0
- package/dist/hooks/useAppCheck.js +2 -0
- package/dist/hooks/useAppCheck.js.map +1 -0
- package/dist/hooks/useAppCheck.mjs +2 -0
- package/dist/hooks/useAppCheck.mjs.map +1 -0
- package/dist/hooks/useMaxAllowedInstances.d.mts +6 -0
- package/dist/hooks/useMaxAllowedInstances.d.ts +6 -0
- package/dist/hooks/useMaxAllowedInstances.js +2 -0
- package/dist/hooks/useMaxAllowedInstances.js.map +1 -0
- package/dist/hooks/useMaxAllowedInstances.mjs +2 -0
- package/dist/hooks/useMaxAllowedInstances.mjs.map +1 -0
- package/dist/hooks/useSignIn.d.mts +4 -4
- package/dist/hooks/useSignIn.d.ts +4 -4
- package/dist/hooks/useSignIn.js +1 -1
- package/dist/hooks/useSignIn.js.map +1 -1
- package/dist/hooks/useSignIn.mjs +1 -1
- package/dist/hooks/useSignIn.mjs.map +1 -1
- package/dist/hooks/useWaitForComponentMount.d.mts +8 -0
- package/dist/hooks/useWaitForComponentMount.d.ts +8 -0
- package/dist/hooks/useWaitForComponentMount.js +2 -0
- package/dist/hooks/useWaitForComponentMount.js.map +1 -0
- package/dist/hooks/useWaitForComponentMount.mjs +2 -0
- package/dist/hooks/useWaitForComponentMount.mjs.map +1 -0
- package/dist/index.d.mts +3 -5
- package/dist/index.d.ts +3 -5
- 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 +29 -5
- package/dist/lib/isoTernSecureAuth.d.ts +29 -5
- package/dist/lib/isoTernSecureAuth.js +1 -1
- package/dist/lib/isoTernSecureAuth.js.map +1 -1
- package/dist/lib/isoTernSecureAuth.mjs +1 -1
- package/dist/lib/isoTernSecureAuth.mjs.map +1 -1
- package/dist/types.d.mts +43 -28
- package/dist/types.d.ts +43 -28
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/debug.d.mts +2 -1
- package/dist/utils/debug.d.ts +2 -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/dist/utils/isConstructor.d.mts +3 -0
- package/dist/utils/isConstructor.d.ts +3 -0
- package/dist/utils/isConstructor.js +2 -0
- package/dist/utils/isConstructor.js.map +1 -0
- package/dist/utils/isConstructor.mjs +2 -0
- package/dist/utils/isConstructor.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/ctx/SignInCtx.d.mts +0 -27
- package/dist/ctx/SignInCtx.d.ts +0 -27
- package/dist/ctx/SignInCtx.js +0 -2
- package/dist/ctx/SignInCtx.js.map +0 -1
- package/dist/ctx/SignInCtx.mjs +0 -2
- package/dist/ctx/SignInCtx.mjs.map +0 -1
- package/dist/ctx/SignUpCtx.d.mts +0 -22
- package/dist/ctx/SignUpCtx.d.ts +0 -22
- package/dist/ctx/SignUpCtx.js +0 -2
- package/dist/ctx/SignUpCtx.js.map +0 -1
- package/dist/ctx/SignUpCtx.mjs +0 -2
- package/dist/ctx/SignUpCtx.mjs.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { PropsWithChildren } from 'react';
|
|
3
|
+
import { MountProps, OpenProps } from '../types.mjs';
|
|
4
|
+
import '@tern-secure/types';
|
|
5
|
+
|
|
6
|
+
type HostRendererProps = PropsWithChildren<(MountProps | OpenProps) & {
|
|
7
|
+
component?: string;
|
|
8
|
+
hideRootHtmlElement?: boolean;
|
|
9
|
+
rootProps?: React__default.JSX.IntrinsicElements['div'];
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* TernSecureHostRenderer is responsible for the actual mounting/unmounting of UI components
|
|
13
|
+
* from the @tern-secure/auth package. It handles the lifecycle of the mounted component
|
|
14
|
+
* and ensures proper cleanup.
|
|
15
|
+
*/
|
|
16
|
+
declare class TernSecureHostRenderer extends React__default.PureComponent<HostRendererProps> {
|
|
17
|
+
private rootRef;
|
|
18
|
+
componentDidUpdate(_prevProps: Readonly<MountProps | OpenProps>): void;
|
|
19
|
+
componentDidMount(): void;
|
|
20
|
+
componentWillUnmount(): void;
|
|
21
|
+
render(): react_jsx_runtime.JSX.Element;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { TernSecureHostRenderer };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { PropsWithChildren } from 'react';
|
|
3
|
+
import { MountProps, OpenProps } from '../types.js';
|
|
4
|
+
import '@tern-secure/types';
|
|
5
|
+
|
|
6
|
+
type HostRendererProps = PropsWithChildren<(MountProps | OpenProps) & {
|
|
7
|
+
component?: string;
|
|
8
|
+
hideRootHtmlElement?: boolean;
|
|
9
|
+
rootProps?: React__default.JSX.IntrinsicElements['div'];
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* TernSecureHostRenderer is responsible for the actual mounting/unmounting of UI components
|
|
13
|
+
* from the @tern-secure/auth package. It handles the lifecycle of the mounted component
|
|
14
|
+
* and ensures proper cleanup.
|
|
15
|
+
*/
|
|
16
|
+
declare class TernSecureHostRenderer extends React__default.PureComponent<HostRendererProps> {
|
|
17
|
+
private rootRef;
|
|
18
|
+
componentDidUpdate(_prevProps: Readonly<MountProps | OpenProps>): void;
|
|
19
|
+
componentDidMount(): void;
|
|
20
|
+
componentWillUnmount(): void;
|
|
21
|
+
render(): react_jsx_runtime.JSX.Element;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { TernSecureHostRenderer };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var M=Object.create;var p=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var H=(o,t)=>{for(var s in t)p(o,s,{get:t[s],enumerable:!0})},h=(o,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of I(t))!y.call(o,r)&&r!==s&&p(o,r,{get:()=>t[r],enumerable:!(e=R(t,r))||e.enumerable});return o};var v=(o,t,s)=>(s=o!=null?M(g(o)):{},h(t||!o||!o.__esModule?p(s,"default",{value:o,enumerable:!0}):s,o)),E=o=>h(p({},"__esModule",{value:!0}),o);var C={};H(C,{TernSecureHostRenderer:()=>D});module.exports=E(C);var n=require("react/jsx-runtime"),u=require("@tern-secure/shared/object"),m=require("@tern-secure/shared/react"),c=v(require("react"));const i=o=>"mount"in o,l=o=>"open"in o,a=o=>o?.map(({mountIcon:t,unmountIcon:s,...e})=>e);class D extends c.default.PureComponent{rootRef=c.default.createRef();componentDidUpdate(t){if(!i(t)||!i(this.props))return;const s=(0,u.without)(t.props,"customPages","customMenuItems","children"),e=(0,u.without)(this.props.props,"customPages","customMenuItems","children"),r=s.customPages?.length!==e.customPages?.length,d=s.customMenuItems?.length!==e.customMenuItems?.length,f=a(t.props.customMenuItems),P=a(this.props.props.customMenuItems);(!(0,m.isDeeplyEqual)(s,e)||!(0,m.isDeeplyEqual)(f,P)||r||d)&&this.rootRef.current&&this.props.updateProps({node:this.rootRef.current,props:this.props.props})}componentDidMount(){this.rootRef.current&&(i(this.props)&&this.props.mount(this.rootRef.current,this.props.props),l(this.props)&&this.props.open(this.props.props))}componentWillUnmount(){this.rootRef.current&&(i(this.props)&&this.props.unmount(this.rootRef.current),l(this.props)&&this.props.close())}render(){const{hideRootHtmlElement:t=!1}=this.props,s={ref:this.rootRef,...this.props.rootProps,...this.props.component&&{"data-ternsecure-component":this.props.component}};return(0,n.jsxs)(n.Fragment,{children:[!t&&(0,n.jsx)("div",{...s}),this.props.children]})}}0&&(module.exports={TernSecureHostRenderer});
|
|
2
|
+
//# sourceMappingURL=TernSecureHostRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/TernSecureHostRenderer.tsx"],"sourcesContent":["import { without } from '@tern-secure/shared/object';\nimport { isDeeplyEqual } from '@tern-secure/shared/react';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport type { MountProps, OpenProps } from '../types';\n\nconst isMountProps = (props: any): props is MountProps => {\n return 'mount' in props;\n};\n\nconst isOpenProps = (props: any): props is OpenProps => {\n return 'open' in props;\n};\n\nconst stripMenuItemIconHandlers = (\n menuItems?: Array<{\n mountIcon?: (el: HTMLDivElement) => void;\n unmountIcon?: (el: HTMLDivElement) => void;\n [key: string]: any;\n }>,\n) => {\n return menuItems?.map(({ mountIcon, unmountIcon, ...rest }) => rest);\n};\n\ntype HostRendererProps = PropsWithChildren<\n (MountProps | OpenProps) & {\n component?: string;\n hideRootHtmlElement?: boolean;\n rootProps?: React.JSX.IntrinsicElements['div'];\n }\n>;\n\n/**\n * TernSecureHostRenderer is responsible for the actual mounting/unmounting of UI components\n * from the @tern-secure/auth package. It handles the lifecycle of the mounted component\n * and ensures proper cleanup.\n */\nexport class TernSecureHostRenderer extends React.PureComponent<HostRendererProps> {\n private rootRef = React.createRef<HTMLDivElement>();\n\n componentDidUpdate(_prevProps: Readonly<MountProps | OpenProps>) {\n if (!isMountProps(_prevProps) || !isMountProps(this.props)) {\n return;\n }\n\n const prevProps = without(_prevProps.props, 'customPages', 'customMenuItems', 'children');\n const newProps = without(this.props.props, 'customPages', 'customMenuItems', 'children');\n\n const customPagesChanged = prevProps.customPages?.length !== newProps.customPages?.length;\n const customMenuItemsChanged =\n prevProps.customMenuItems?.length !== newProps.customMenuItems?.length;\n\n const prevMenuItemsWithoutHandlers = stripMenuItemIconHandlers(\n _prevProps.props.customMenuItems,\n );\n const newMenuItemsWithoutHandlers = stripMenuItemIconHandlers(this.props.props.customMenuItems);\n\n if (\n !isDeeplyEqual(prevProps, newProps) ||\n !isDeeplyEqual(prevMenuItemsWithoutHandlers, newMenuItemsWithoutHandlers) ||\n customPagesChanged ||\n customMenuItemsChanged\n ) {\n if (this.rootRef.current) {\n this.props.updateProps({ node: this.rootRef.current, props: this.props.props });\n }\n }\n }\n\n componentDidMount() {\n if (this.rootRef.current) {\n if (isMountProps(this.props)) {\n this.props.mount(this.rootRef.current, this.props.props);\n }\n\n if (isOpenProps(this.props)) {\n this.props.open(this.props.props);\n }\n }\n }\n\n componentWillUnmount() {\n if (this.rootRef.current) {\n if (isMountProps(this.props)) {\n this.props.unmount(this.rootRef.current);\n }\n if (isOpenProps(this.props)) {\n this.props.close();\n }\n }\n }\n\n render() {\n const { hideRootHtmlElement = false } = this.props;\n const rootAttributes = {\n ref: this.rootRef,\n ...this.props.rootProps,\n ...(this.props.component && { 'data-ternsecure-component': this.props.component }),\n };\n\n return (\n <>\n {!hideRootHtmlElement && <div {...rootAttributes} />}\n {this.props.children}\n </>\n );\n }\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAsGM,IAAAI,EAAA,6BAtGNC,EAAwB,sCACxBC,EAA8B,qCAE9BA,EAAkB,oBAIlB,MAAMC,EAAgBC,GACb,UAAWA,EAGdC,EAAeD,GACZ,SAAUA,EAGbE,EACJC,GAMOA,GAAW,IAAI,CAAC,CAAE,UAAAC,EAAW,YAAAC,EAAa,GAAGC,CAAK,IAAMA,CAAI,EAgB9D,MAAMZ,UAA+B,EAAAa,QAAM,aAAiC,CACzE,QAAU,EAAAA,QAAM,UAA0B,EAElD,mBAAmBC,EAA8C,CAC/D,GAAI,CAACT,EAAaS,CAAU,GAAK,CAACT,EAAa,KAAK,KAAK,EACvD,OAGF,MAAMU,KAAY,WAAQD,EAAW,MAAO,cAAe,kBAAmB,UAAU,EAClFE,KAAW,WAAQ,KAAK,MAAM,MAAO,cAAe,kBAAmB,UAAU,EAEjFC,EAAqBF,EAAU,aAAa,SAAWC,EAAS,aAAa,OAC7EE,EACJH,EAAU,iBAAiB,SAAWC,EAAS,iBAAiB,OAE5DG,EAA+BX,EACnCM,EAAW,MAAM,eACnB,EACMM,EAA8BZ,EAA0B,KAAK,MAAM,MAAM,eAAe,GAG5F,IAAC,iBAAcO,EAAWC,CAAQ,GAClC,IAAC,iBAAcG,EAA8BC,CAA2B,GACxEH,GACAC,IAEI,KAAK,QAAQ,SACf,KAAK,MAAM,YAAY,CAAE,KAAM,KAAK,QAAQ,QAAS,MAAO,KAAK,MAAM,KAAM,CAAC,CAGpF,CAEA,mBAAoB,CACd,KAAK,QAAQ,UACXb,EAAa,KAAK,KAAK,GACzB,KAAK,MAAM,MAAM,KAAK,QAAQ,QAAS,KAAK,MAAM,KAAK,EAGrDE,EAAY,KAAK,KAAK,GACxB,KAAK,MAAM,KAAK,KAAK,MAAM,KAAK,EAGtC,CAEA,sBAAuB,CACjB,KAAK,QAAQ,UACXF,EAAa,KAAK,KAAK,GACzB,KAAK,MAAM,QAAQ,KAAK,QAAQ,OAAO,EAErCE,EAAY,KAAK,KAAK,GACxB,KAAK,MAAM,MAAM,EAGvB,CAEA,QAAS,CACP,KAAM,CAAE,oBAAAc,EAAsB,EAAM,EAAI,KAAK,MACvCC,EAAiB,CACrB,IAAK,KAAK,QACV,GAAG,KAAK,MAAM,UACd,GAAI,KAAK,MAAM,WAAa,CAAE,4BAA6B,KAAK,MAAM,SAAU,CAClF,EAEA,SACE,oBACG,WAACD,MAAuB,OAAC,OAAK,GAAGC,EAAgB,EACjD,KAAK,MAAM,UACd,CAEJ,CACF","names":["TernSecureHostRenderer_exports","__export","TernSecureHostRenderer","__toCommonJS","import_jsx_runtime","import_object","import_react","isMountProps","props","isOpenProps","stripMenuItemIconHandlers","menuItems","mountIcon","unmountIcon","rest","React","_prevProps","prevProps","newProps","customPagesChanged","customMenuItemsChanged","prevMenuItemsWithoutHandlers","newMenuItemsWithoutHandlers","hideRootHtmlElement","rootAttributes"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as f,jsx as d,jsxs as P}from"react/jsx-runtime";import{without as n}from"@tern-secure/shared/object";import{isDeeplyEqual as p}from"@tern-secure/shared/react";import i from"react";const r=o=>"mount"in o,u=o=>"open"in o,m=o=>o?.map(({mountIcon:t,unmountIcon:s,...e})=>e);class g extends i.PureComponent{rootRef=i.createRef();componentDidUpdate(t){if(!r(t)||!r(this.props))return;const s=n(t.props,"customPages","customMenuItems","children"),e=n(this.props.props,"customPages","customMenuItems","children"),c=s.customPages?.length!==e.customPages?.length,h=s.customMenuItems?.length!==e.customMenuItems?.length,l=m(t.props.customMenuItems),a=m(this.props.props.customMenuItems);(!p(s,e)||!p(l,a)||c||h)&&this.rootRef.current&&this.props.updateProps({node:this.rootRef.current,props:this.props.props})}componentDidMount(){this.rootRef.current&&(r(this.props)&&this.props.mount(this.rootRef.current,this.props.props),u(this.props)&&this.props.open(this.props.props))}componentWillUnmount(){this.rootRef.current&&(r(this.props)&&this.props.unmount(this.rootRef.current),u(this.props)&&this.props.close())}render(){const{hideRootHtmlElement:t=!1}=this.props,s={ref:this.rootRef,...this.props.rootProps,...this.props.component&&{"data-ternsecure-component":this.props.component}};return P(f,{children:[!t&&d("div",{...s}),this.props.children]})}}export{g as TernSecureHostRenderer};
|
|
2
|
+
//# sourceMappingURL=TernSecureHostRenderer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/TernSecureHostRenderer.tsx"],"sourcesContent":["import { without } from '@tern-secure/shared/object';\nimport { isDeeplyEqual } from '@tern-secure/shared/react';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport type { MountProps, OpenProps } from '../types';\n\nconst isMountProps = (props: any): props is MountProps => {\n return 'mount' in props;\n};\n\nconst isOpenProps = (props: any): props is OpenProps => {\n return 'open' in props;\n};\n\nconst stripMenuItemIconHandlers = (\n menuItems?: Array<{\n mountIcon?: (el: HTMLDivElement) => void;\n unmountIcon?: (el: HTMLDivElement) => void;\n [key: string]: any;\n }>,\n) => {\n return menuItems?.map(({ mountIcon, unmountIcon, ...rest }) => rest);\n};\n\ntype HostRendererProps = PropsWithChildren<\n (MountProps | OpenProps) & {\n component?: string;\n hideRootHtmlElement?: boolean;\n rootProps?: React.JSX.IntrinsicElements['div'];\n }\n>;\n\n/**\n * TernSecureHostRenderer is responsible for the actual mounting/unmounting of UI components\n * from the @tern-secure/auth package. It handles the lifecycle of the mounted component\n * and ensures proper cleanup.\n */\nexport class TernSecureHostRenderer extends React.PureComponent<HostRendererProps> {\n private rootRef = React.createRef<HTMLDivElement>();\n\n componentDidUpdate(_prevProps: Readonly<MountProps | OpenProps>) {\n if (!isMountProps(_prevProps) || !isMountProps(this.props)) {\n return;\n }\n\n const prevProps = without(_prevProps.props, 'customPages', 'customMenuItems', 'children');\n const newProps = without(this.props.props, 'customPages', 'customMenuItems', 'children');\n\n const customPagesChanged = prevProps.customPages?.length !== newProps.customPages?.length;\n const customMenuItemsChanged =\n prevProps.customMenuItems?.length !== newProps.customMenuItems?.length;\n\n const prevMenuItemsWithoutHandlers = stripMenuItemIconHandlers(\n _prevProps.props.customMenuItems,\n );\n const newMenuItemsWithoutHandlers = stripMenuItemIconHandlers(this.props.props.customMenuItems);\n\n if (\n !isDeeplyEqual(prevProps, newProps) ||\n !isDeeplyEqual(prevMenuItemsWithoutHandlers, newMenuItemsWithoutHandlers) ||\n customPagesChanged ||\n customMenuItemsChanged\n ) {\n if (this.rootRef.current) {\n this.props.updateProps({ node: this.rootRef.current, props: this.props.props });\n }\n }\n }\n\n componentDidMount() {\n if (this.rootRef.current) {\n if (isMountProps(this.props)) {\n this.props.mount(this.rootRef.current, this.props.props);\n }\n\n if (isOpenProps(this.props)) {\n this.props.open(this.props.props);\n }\n }\n }\n\n componentWillUnmount() {\n if (this.rootRef.current) {\n if (isMountProps(this.props)) {\n this.props.unmount(this.rootRef.current);\n }\n if (isOpenProps(this.props)) {\n this.props.close();\n }\n }\n }\n\n render() {\n const { hideRootHtmlElement = false } = this.props;\n const rootAttributes = {\n ref: this.rootRef,\n ...this.props.rootProps,\n ...(this.props.component && { 'data-ternsecure-component': this.props.component }),\n };\n\n return (\n <>\n {!hideRootHtmlElement && <div {...rootAttributes} />}\n {this.props.children}\n </>\n );\n }\n}\n"],"mappings":"AAsGM,mBAAAA,EAC2B,OAAAC,EAD3B,QAAAC,MAAA,oBAtGN,OAAS,WAAAC,MAAe,6BACxB,OAAS,iBAAAC,MAAqB,4BAE9B,OAAOC,MAAW,QAIlB,MAAMC,EAAgBC,GACb,UAAWA,EAGdC,EAAeD,GACZ,SAAUA,EAGbE,EACJC,GAMOA,GAAW,IAAI,CAAC,CAAE,UAAAC,EAAW,YAAAC,EAAa,GAAGC,CAAK,IAAMA,CAAI,EAgB9D,MAAMC,UAA+BT,EAAM,aAAiC,CACzE,QAAUA,EAAM,UAA0B,EAElD,mBAAmBU,EAA8C,CAC/D,GAAI,CAACT,EAAaS,CAAU,GAAK,CAACT,EAAa,KAAK,KAAK,EACvD,OAGF,MAAMU,EAAYb,EAAQY,EAAW,MAAO,cAAe,kBAAmB,UAAU,EAClFE,EAAWd,EAAQ,KAAK,MAAM,MAAO,cAAe,kBAAmB,UAAU,EAEjFe,EAAqBF,EAAU,aAAa,SAAWC,EAAS,aAAa,OAC7EE,EACJH,EAAU,iBAAiB,SAAWC,EAAS,iBAAiB,OAE5DG,EAA+BX,EACnCM,EAAW,MAAM,eACnB,EACMM,EAA8BZ,EAA0B,KAAK,MAAM,MAAM,eAAe,GAG5F,CAACL,EAAcY,EAAWC,CAAQ,GAClC,CAACb,EAAcgB,EAA8BC,CAA2B,GACxEH,GACAC,IAEI,KAAK,QAAQ,SACf,KAAK,MAAM,YAAY,CAAE,KAAM,KAAK,QAAQ,QAAS,MAAO,KAAK,MAAM,KAAM,CAAC,CAGpF,CAEA,mBAAoB,CACd,KAAK,QAAQ,UACXb,EAAa,KAAK,KAAK,GACzB,KAAK,MAAM,MAAM,KAAK,QAAQ,QAAS,KAAK,MAAM,KAAK,EAGrDE,EAAY,KAAK,KAAK,GACxB,KAAK,MAAM,KAAK,KAAK,MAAM,KAAK,EAGtC,CAEA,sBAAuB,CACjB,KAAK,QAAQ,UACXF,EAAa,KAAK,KAAK,GACzB,KAAK,MAAM,QAAQ,KAAK,QAAQ,OAAO,EAErCE,EAAY,KAAK,KAAK,GACxB,KAAK,MAAM,MAAM,EAGvB,CAEA,QAAS,CACP,KAAM,CAAE,oBAAAc,EAAsB,EAAM,EAAI,KAAK,MACvCC,EAAiB,CACrB,IAAK,KAAK,QACV,GAAG,KAAK,MAAM,UACd,GAAI,KAAK,MAAM,WAAa,CAAE,4BAA6B,KAAK,MAAM,SAAU,CAClF,EAEA,OACErB,EAAAF,EAAA,CACG,WAACsB,GAAuBrB,EAAC,OAAK,GAAGsB,EAAgB,EACjD,KAAK,MAAM,UACd,CAEJ,CACF","names":["Fragment","jsx","jsxs","without","isDeeplyEqual","React","isMountProps","props","isOpenProps","stripMenuItemIconHandlers","menuItems","mountIcon","unmountIcon","rest","TernSecureHostRenderer","_prevProps","prevProps","newProps","customPagesChanged","customMenuItemsChanged","prevMenuItemsWithoutHandlers","newMenuItemsWithoutHandlers","hideRootHtmlElement","rootAttributes"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as _tern_secure_types from '@tern-secure/types';
|
|
3
|
+
import { SignInProps, SignUpProps } from '@tern-secure/types';
|
|
4
|
+
import { WithTernSecureProp } from '../types.mjs';
|
|
5
|
+
|
|
6
|
+
type FallbackProp = {
|
|
7
|
+
/**
|
|
8
|
+
* An optional element to render while the component is mounting.
|
|
9
|
+
*/
|
|
10
|
+
fallback?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
type SignInComponentProps = WithTernSecureProp<SignInProps> & FallbackProp;
|
|
13
|
+
type SignUpComponentProps = WithTernSecureProp<SignUpProps> & FallbackProp;
|
|
14
|
+
declare const SignIn: {
|
|
15
|
+
(props: _tern_secure_types.Without<SignInComponentProps, "ternsecure">): react_jsx_runtime.JSX.Element | null;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
declare const SignUp: {
|
|
19
|
+
(props: _tern_secure_types.Without<SignUpComponentProps, "ternsecure">): react_jsx_runtime.JSX.Element | null;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
declare const UserButton: {
|
|
23
|
+
(props: _tern_secure_types.Without<{
|
|
24
|
+
ternsecure: _tern_secure_types.TernSecureAuth;
|
|
25
|
+
component?: string;
|
|
26
|
+
}, "ternsecure">): react_jsx_runtime.JSX.Element | null;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { SignIn, SignUp, UserButton };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as _tern_secure_types from '@tern-secure/types';
|
|
3
|
+
import { SignInProps, SignUpProps } from '@tern-secure/types';
|
|
4
|
+
import { WithTernSecureProp } from '../types.js';
|
|
5
|
+
|
|
6
|
+
type FallbackProp = {
|
|
7
|
+
/**
|
|
8
|
+
* An optional element to render while the component is mounting.
|
|
9
|
+
*/
|
|
10
|
+
fallback?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
type SignInComponentProps = WithTernSecureProp<SignInProps> & FallbackProp;
|
|
13
|
+
type SignUpComponentProps = WithTernSecureProp<SignUpProps> & FallbackProp;
|
|
14
|
+
declare const SignIn: {
|
|
15
|
+
(props: _tern_secure_types.Without<SignInComponentProps, "ternsecure">): react_jsx_runtime.JSX.Element | null;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
declare const SignUp: {
|
|
19
|
+
(props: _tern_secure_types.Without<SignUpComponentProps, "ternsecure">): react_jsx_runtime.JSX.Element | null;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
declare const UserButton: {
|
|
23
|
+
(props: _tern_secure_types.Without<{
|
|
24
|
+
ternsecure: _tern_secure_types.TernSecureAuth;
|
|
25
|
+
component?: string;
|
|
26
|
+
}, "ternsecure">): react_jsx_runtime.JSX.Element | null;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { SignIn, SignUp, UserButton };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var S=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var P=(o,n)=>{for(var p in n)S(o,p,{get:n[p],enumerable:!0})},y=(o,n,p,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of g(n))!l.call(o,e)&&e!==p&&S(o,e,{get:()=>n[e],enumerable:!(r=m(n,e))||r.enumerable});return o};var h=o=>y(S({},"__esModule",{value:!0}),o);var R={};P(R,{SignIn:()=>c,SignUp:()=>U,UserButton:()=>_});module.exports=h(R);var t=require("react/jsx-runtime"),i=require("../hooks/useWaitForComponentMount"),a=require("./TernSecureHostRenderer"),u=require("./withTernSecure");const c=(0,u.withTernSecure)(({ternsecure:o,component:n,fallback:p,...r})=>{const s=(0,i.useWaitForComponentMount)(n)==="rendering"||!o.isReady,d={...s&&p&&{style:{display:"none"}}};return(0,t.jsxs)(t.Fragment,{children:[s&&p,o.isReady&&(0,t.jsx)(a.TernSecureHostRenderer,{component:n,mount:o.showSignIn,unmount:o.hideSignIn,updateProps:o.__unstable__updateProps,props:r,rootProps:d})]})},{component:"SignIn",renderWhileLoading:!0}),U=(0,u.withTernSecure)(({ternsecure:o,component:n,fallback:p,...r})=>{const s=(0,i.useWaitForComponentMount)(n)==="rendering"||!o.isReady,d={...s&&p&&{style:{display:"none"}}};return(0,t.jsxs)(t.Fragment,{children:[s&&p,o.isReady&&(0,t.jsx)(a.TernSecureHostRenderer,{component:n,mount:o.showSignUp,unmount:o.hideSignUp,updateProps:o.__unstable__updateProps,props:r,rootProps:d})]})},{component:"SignUp",renderWhileLoading:!0}),_=(0,u.withTernSecure)(({ternsecure:o,component:n})=>{const r=(0,i.useWaitForComponentMount)(n)==="rendering"||!o.isReady;return(0,t.jsxs)(t.Fragment,{children:[r,o.isReady&&(0,t.jsx)(a.TernSecureHostRenderer,{component:n,mount:o.showUserButton,unmount:o.hideUserButton,updateProps:o.__unstable__updateProps,props:{},rootProps:{...r&&{style:{display:"none"}}}})]})},{component:"UserButton",renderWhileLoading:!0});0&&(module.exports={SignIn,SignUp,UserButton});
|
|
2
|
+
//# sourceMappingURL=uiComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/uiComponent.tsx"],"sourcesContent":["import type {\n SignInProps,\n SignUpProps,\n} from '@tern-secure/types';\n\nimport { useWaitForComponentMount } from '../hooks/useWaitForComponentMount';\nimport type { WithTernSecureProp } from '../types';\nimport { TernSecureHostRenderer } from './TernSecureHostRenderer';\nimport { withTernSecure } from './withTernSecure';\n\ntype FallbackProp = {\n /**\n * An optional element to render while the component is mounting.\n */\n fallback?: React.ReactNode;\n};\n\n// Internal component props including ternsecure instance from withTernSecure\ntype SignInComponentProps = WithTernSecureProp<SignInProps> & FallbackProp;\n\ntype SignUpComponentProps = WithTernSecureProp<SignUpProps> & FallbackProp;\n\nexport const SignIn = withTernSecure(\n ({ ternsecure, component, fallback, ...props }: SignInComponentProps) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !ternsecure.isReady;\n\n const rendererRootProps = {\n ...(shouldShowFallback && fallback && { style: { display: 'none' } }),\n }\n\n return (\n <>\n {shouldShowFallback && fallback}\n {ternsecure.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={ternsecure.showSignIn}\n unmount={ternsecure.hideSignIn}\n updateProps={(ternsecure as any).__unstable__updateProps}\n props={props}\n rootProps={rendererRootProps}\n />\n )}\n </>\n );\n },\n { component: 'SignIn', renderWhileLoading: true },\n);\n\nexport const SignUp = withTernSecure(\n ({ ternsecure, component, fallback, ...props }: SignUpComponentProps) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !ternsecure.isReady;\n\n const rendererRootProps = {\n ...(shouldShowFallback && fallback && { style: { display: 'none' } }),\n }\n\n return (\n <>\n {shouldShowFallback && fallback}\n {ternsecure.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={ternsecure.showSignUp}\n unmount={ternsecure.hideSignUp}\n updateProps={(ternsecure as any).__unstable__updateProps}\n props={props}\n rootProps={rendererRootProps}\n />\n )}\n </>\n );\n },\n { component: 'SignUp', renderWhileLoading: true },\n);\n\nexport const UserButton = withTernSecure(\n ({ ternsecure, component }) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !ternsecure.isReady;\n\n return (\n <>\n {shouldShowFallback}\n {ternsecure.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={ternsecure.showUserButton}\n unmount={ternsecure.hideUserButton}\n updateProps={(ternsecure as any).__unstable__updateProps}\n props={{}}\n rootProps={{\n ...(shouldShowFallback && { style: { display: 'none' } }),\n }}\n />\n )}\n </>\n );\n },\n { component: 'UserButton', renderWhileLoading: true },\n);\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,WAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,GAgCM,IAAAM,EAAA,6BA3BNC,EAAyC,6CAEzCC,EAAuC,oCACvCC,EAA+B,4BAcxB,MAAMP,KAAS,kBACpB,CAAC,CAAE,WAAAQ,EAAY,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,IAA4B,CAEvE,MAAMC,KADiB,4BAAyBH,CAAS,IACX,aAAe,CAACD,EAAW,QAEnEK,EAAqB,CACzB,GAAID,GAAsBF,GAAY,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACrE,EAEA,SACE,oBACG,UAAAE,GAAsBF,EACtBF,EAAW,YACV,OAAC,0BACC,UAAWC,EACX,MAAOD,EAAW,WAClB,QAASA,EAAW,WACpB,YAAcA,EAAmB,wBACjC,MAAOG,EACP,UAAWE,EACb,GAEJ,CAEJ,EACA,CAAE,UAAW,SAAU,mBAAoB,EAAK,CAClD,EAEaZ,KAAS,kBACpB,CAAC,CAAE,WAAAO,EAAY,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,IAA4B,CAEvE,MAAMC,KADiB,4BAAyBH,CAAS,IACX,aAAe,CAACD,EAAW,QAEnEK,EAAoB,CACxB,GAAID,GAAsBF,GAAY,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACrE,EAEA,SACE,oBACG,UAAAE,GAAsBF,EACtBF,EAAW,YACV,OAAC,0BACC,UAAWC,EACX,MAAOD,EAAW,WAClB,QAASA,EAAW,WACpB,YAAcA,EAAmB,wBACjC,MAAOG,EACP,UAAWE,EACb,GAEJ,CAEJ,EACA,CAAE,UAAW,SAAU,mBAAoB,EAAK,CAClD,EAEaX,KAAa,kBACxB,CAAC,CAAE,WAAAM,EAAY,UAAAC,CAAU,IAAM,CAE7B,MAAMG,KADiB,4BAAyBH,CAAS,IACX,aAAe,CAACD,EAAW,QAEzE,SACE,oBACG,UAAAI,EACAJ,EAAW,YACV,OAAC,0BACC,UAAWC,EACX,MAAOD,EAAW,eAClB,QAASA,EAAW,eACpB,YAAcA,EAAmB,wBACjC,MAAO,CAAC,EACR,UAAW,CACT,GAAII,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_useWaitForComponentMount","import_TernSecureHostRenderer","import_withTernSecure","ternsecure","component","fallback","props","shouldShowFallback","rendererRootProps"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as d,jsx as u,jsxs as S}from"react/jsx-runtime";import{useWaitForComponentMount as s}from"../hooks/useWaitForComponentMount";import{TernSecureHostRenderer as i}from"./TernSecureHostRenderer";import{withTernSecure as a}from"./withTernSecure";const y=a(({ternsecure:o,component:n,fallback:t,...p})=>{const r=s(n)==="rendering"||!o.isReady,e={...r&&t&&{style:{display:"none"}}};return S(d,{children:[r&&t,o.isReady&&u(i,{component:n,mount:o.showSignIn,unmount:o.hideSignIn,updateProps:o.__unstable__updateProps,props:p,rootProps:e})]})},{component:"SignIn",renderWhileLoading:!0}),h=a(({ternsecure:o,component:n,fallback:t,...p})=>{const r=s(n)==="rendering"||!o.isReady,e={...r&&t&&{style:{display:"none"}}};return S(d,{children:[r&&t,o.isReady&&u(i,{component:n,mount:o.showSignUp,unmount:o.hideSignUp,updateProps:o.__unstable__updateProps,props:p,rootProps:e})]})},{component:"SignUp",renderWhileLoading:!0}),c=a(({ternsecure:o,component:n})=>{const p=s(n)==="rendering"||!o.isReady;return S(d,{children:[p,o.isReady&&u(i,{component:n,mount:o.showUserButton,unmount:o.hideUserButton,updateProps:o.__unstable__updateProps,props:{},rootProps:{...p&&{style:{display:"none"}}}})]})},{component:"UserButton",renderWhileLoading:!0});export{y as SignIn,h as SignUp,c as UserButton};
|
|
2
|
+
//# sourceMappingURL=uiComponent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/uiComponent.tsx"],"sourcesContent":["import type {\n SignInProps,\n SignUpProps,\n} from '@tern-secure/types';\n\nimport { useWaitForComponentMount } from '../hooks/useWaitForComponentMount';\nimport type { WithTernSecureProp } from '../types';\nimport { TernSecureHostRenderer } from './TernSecureHostRenderer';\nimport { withTernSecure } from './withTernSecure';\n\ntype FallbackProp = {\n /**\n * An optional element to render while the component is mounting.\n */\n fallback?: React.ReactNode;\n};\n\n// Internal component props including ternsecure instance from withTernSecure\ntype SignInComponentProps = WithTernSecureProp<SignInProps> & FallbackProp;\n\ntype SignUpComponentProps = WithTernSecureProp<SignUpProps> & FallbackProp;\n\nexport const SignIn = withTernSecure(\n ({ ternsecure, component, fallback, ...props }: SignInComponentProps) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !ternsecure.isReady;\n\n const rendererRootProps = {\n ...(shouldShowFallback && fallback && { style: { display: 'none' } }),\n }\n\n return (\n <>\n {shouldShowFallback && fallback}\n {ternsecure.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={ternsecure.showSignIn}\n unmount={ternsecure.hideSignIn}\n updateProps={(ternsecure as any).__unstable__updateProps}\n props={props}\n rootProps={rendererRootProps}\n />\n )}\n </>\n );\n },\n { component: 'SignIn', renderWhileLoading: true },\n);\n\nexport const SignUp = withTernSecure(\n ({ ternsecure, component, fallback, ...props }: SignUpComponentProps) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !ternsecure.isReady;\n\n const rendererRootProps = {\n ...(shouldShowFallback && fallback && { style: { display: 'none' } }),\n }\n\n return (\n <>\n {shouldShowFallback && fallback}\n {ternsecure.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={ternsecure.showSignUp}\n unmount={ternsecure.hideSignUp}\n updateProps={(ternsecure as any).__unstable__updateProps}\n props={props}\n rootProps={rendererRootProps}\n />\n )}\n </>\n );\n },\n { component: 'SignUp', renderWhileLoading: true },\n);\n\nexport const UserButton = withTernSecure(\n ({ ternsecure, component }) => {\n const mountingStatus = useWaitForComponentMount(component);\n const shouldShowFallback = mountingStatus === 'rendering' || !ternsecure.isReady;\n\n return (\n <>\n {shouldShowFallback}\n {ternsecure.isReady && (\n <TernSecureHostRenderer\n component={component}\n mount={ternsecure.showUserButton}\n unmount={ternsecure.hideUserButton}\n updateProps={(ternsecure as any).__unstable__updateProps}\n props={{}}\n rootProps={{\n ...(shouldShowFallback && { style: { display: 'none' } }),\n }}\n />\n )}\n </>\n );\n },\n { component: 'UserButton', renderWhileLoading: true },\n);\n"],"mappings":"AAgCM,mBAAAA,EAGI,OAAAC,EAHJ,QAAAC,MAAA,oBA3BN,OAAS,4BAAAC,MAAgC,oCAEzC,OAAS,0BAAAC,MAA8B,2BACvC,OAAS,kBAAAC,MAAsB,mBAcxB,MAAMC,EAASD,EACpB,CAAC,CAAE,WAAAE,EAAY,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,IAA4B,CAEvE,MAAMC,EADiBR,EAAyBK,CAAS,IACX,aAAe,CAACD,EAAW,QAEnEK,EAAqB,CACzB,GAAID,GAAsBF,GAAY,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACrE,EAEA,OACEP,EAAAF,EAAA,CACG,UAAAW,GAAsBF,EACtBF,EAAW,SACVN,EAACG,EAAA,CACC,UAAWI,EACX,MAAOD,EAAW,WAClB,QAASA,EAAW,WACpB,YAAcA,EAAmB,wBACjC,MAAOG,EACP,UAAWE,EACb,GAEJ,CAEJ,EACA,CAAE,UAAW,SAAU,mBAAoB,EAAK,CAClD,EAEaC,EAASR,EACpB,CAAC,CAAE,WAAAE,EAAY,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,IAA4B,CAEvE,MAAMC,EADiBR,EAAyBK,CAAS,IACX,aAAe,CAACD,EAAW,QAEnEK,EAAoB,CACxB,GAAID,GAAsBF,GAAY,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACrE,EAEA,OACEP,EAAAF,EAAA,CACG,UAAAW,GAAsBF,EACtBF,EAAW,SACVN,EAACG,EAAA,CACC,UAAWI,EACX,MAAOD,EAAW,WAClB,QAASA,EAAW,WACpB,YAAcA,EAAmB,wBACjC,MAAOG,EACP,UAAWE,EACb,GAEJ,CAEJ,EACA,CAAE,UAAW,SAAU,mBAAoB,EAAK,CAClD,EAEaE,EAAaT,EACxB,CAAC,CAAE,WAAAE,EAAY,UAAAC,CAAU,IAAM,CAE7B,MAAMG,EADiBR,EAAyBK,CAAS,IACX,aAAe,CAACD,EAAW,QAEzE,OACEL,EAAAF,EAAA,CACG,UAAAW,EACAJ,EAAW,SACVN,EAACG,EAAA,CACC,UAAWI,EACX,MAAOD,EAAW,eAClB,QAASA,EAAW,eACpB,YAAcA,EAAmB,wBACjC,MAAO,CAAC,EACR,UAAW,CACT,GAAII,GAAsB,CAAE,MAAO,CAAE,QAAS,MAAO,CAAE,CACzD,EACF,GAEJ,CAEJ,EACA,CAAE,UAAW,aAAc,mBAAoB,EAAK,CACtD","names":["Fragment","jsx","jsxs","useWaitForComponentMount","TernSecureHostRenderer","withTernSecure","SignIn","ternsecure","component","fallback","props","shouldShowFallback","rendererRootProps","SignUp","UserButton"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TernSecureAuth, Without } from '@tern-secure/types';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
|
|
5
|
+
declare const withTernSecure: <P extends {
|
|
6
|
+
ternsecure: TernSecureAuth;
|
|
7
|
+
component?: string;
|
|
8
|
+
}>(Component: React__default.ComponentType<P>, displayNameOrOptions?: string | {
|
|
9
|
+
component: string;
|
|
10
|
+
renderWhileLoading?: boolean;
|
|
11
|
+
}) => {
|
|
12
|
+
(props: Without<P, "ternsecure">): react_jsx_runtime.JSX.Element | null;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { withTernSecure };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TernSecureAuth, Without } from '@tern-secure/types';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
|
|
5
|
+
declare const withTernSecure: <P extends {
|
|
6
|
+
ternsecure: TernSecureAuth;
|
|
7
|
+
component?: string;
|
|
8
|
+
}>(Component: React__default.ComponentType<P>, displayNameOrOptions?: string | {
|
|
9
|
+
component: string;
|
|
10
|
+
renderWhileLoading?: boolean;
|
|
11
|
+
}) => {
|
|
12
|
+
(props: Without<P, "ternsecure">): react_jsx_runtime.JSX.Element | null;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { withTernSecure };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var f=(r,e)=>{for(var o in e)s(r,o,{get:e[o],enumerable:!0})},T=(r,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of h(e))!y.call(r,n)&&n!==o&&s(r,n,{get:()=>e[n],enumerable:!(t=d(e,n))||t.enumerable});return r};var g=r=>T(s({},"__esModule",{value:!0}),r);var S={};f(S,{withTernSecure:()=>l});module.exports=g(S);var a=require("react/jsx-runtime"),i=require("../ctx/IsomorphicTernSecureCtx"),p=require("../hooks/useAssertWrappedTernSecureProvider");const l=(r,e)=>{const t=(typeof e=="string"?e:e?.component)||r.displayName||r.name||"Component";r.displayName=t;const n=typeof e=="string"?void 0:e,u=m=>{(0,p.useAssertWrappedByTernSecureAuthProvider)(t||"withTernSecure");const c=(0,i.useIsoTernSecureAuthCtx)();return!c.isReady&&!n?.renderWhileLoading?null:(0,a.jsx)(r,{...m,component:t,ternsecure:c})};return u.displayName=`withTernSecure(${t})`,u};0&&(module.exports={withTernSecure});
|
|
2
|
+
//# sourceMappingURL=withTernSecure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/withTernSecure.tsx"],"sourcesContent":["import type { TernSecureAuth, Without } from '@tern-secure/types';\nimport React from 'react';\n\nimport { useIsoTernSecureAuthCtx } from '../ctx/IsomorphicTernSecureCtx';\nimport { useAssertWrappedByTernSecureAuthProvider } from '../hooks/useAssertWrappedTernSecureProvider';\n\n\nexport const withTernSecure = <P extends { ternsecure: TernSecureAuth; component?: string }>(\n Component: React.ComponentType<P>,\n displayNameOrOptions?: string | { component: string; renderWhileLoading?: boolean },\n) => {\n const passedDisplayName = typeof displayNameOrOptions === 'string' ? displayNameOrOptions : displayNameOrOptions?.component;\n const displayName = passedDisplayName || Component.displayName || Component.name || 'Component';\n Component.displayName = displayName;\n\n const options = typeof displayNameOrOptions === 'string' ? undefined : displayNameOrOptions;\n\n const HOC = (props: Without<P, 'ternsecure'>) => {\n useAssertWrappedByTernSecureAuthProvider(displayName || 'withTernSecure');\n\n const ternsecure = useIsoTernSecureAuthCtx();\n\n if (!ternsecure.isReady && !options?.renderWhileLoading) {\n return null;\n }\n\n return (\n <Component\n {...(props as P)}\n component={displayName}\n ternsecure={ternsecure}\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,GA2BM,IAAAI,EAAA,6BAxBNC,EAAwC,0CACxCC,EAAyD,uDAGlD,MAAMJ,EAAiB,CAC5BK,EACAC,IACG,CAEH,MAAMC,GADoB,OAAOD,GAAyB,SAAWA,EAAuBA,GAAsB,YACzED,EAAU,aAAeA,EAAU,MAAQ,YACpFA,EAAU,YAAcE,EAExB,MAAMC,EAAU,OAAOF,GAAyB,SAAW,OAAYA,EAEjEG,EAAOC,GAAoC,IAC/C,4CAAyCH,GAAe,gBAAgB,EAExE,MAAMI,KAAa,2BAAwB,EAE3C,MAAI,CAACA,EAAW,SAAW,CAACH,GAAS,mBAC5B,QAIP,OAACH,EAAA,CACE,GAAIK,EACL,UAAWH,EACX,WAAYI,EACd,CAEJ,EAEA,OAAAF,EAAI,YAAc,kBAAkBF,CAAW,IACxCE,CACT","names":["withTernSecure_exports","__export","withTernSecure","__toCommonJS","import_jsx_runtime","import_IsomorphicTernSecureCtx","import_useAssertWrappedTernSecureProvider","Component","displayNameOrOptions","displayName","options","HOC","props","ternsecure"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";import{useIsoTernSecureAuthCtx as c}from"../ctx/IsomorphicTernSecureCtx";import{useAssertWrappedByTernSecureAuthProvider as i}from"../hooks/useAssertWrappedTernSecureProvider";const f=(r,e)=>{const t=(typeof e=="string"?e:e?.component)||r.displayName||r.name||"Component";r.displayName=t;const s=typeof e=="string"?void 0:e,n=u=>{i(t||"withTernSecure");const o=c();return!o.isReady&&!s?.renderWhileLoading?null:p(r,{...u,component:t,ternsecure:o})};return n.displayName=`withTernSecure(${t})`,n};export{f as withTernSecure};
|
|
2
|
+
//# sourceMappingURL=withTernSecure.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/withTernSecure.tsx"],"sourcesContent":["import type { TernSecureAuth, Without } from '@tern-secure/types';\nimport React from 'react';\n\nimport { useIsoTernSecureAuthCtx } from '../ctx/IsomorphicTernSecureCtx';\nimport { useAssertWrappedByTernSecureAuthProvider } from '../hooks/useAssertWrappedTernSecureProvider';\n\n\nexport const withTernSecure = <P extends { ternsecure: TernSecureAuth; component?: string }>(\n Component: React.ComponentType<P>,\n displayNameOrOptions?: string | { component: string; renderWhileLoading?: boolean },\n) => {\n const passedDisplayName = typeof displayNameOrOptions === 'string' ? displayNameOrOptions : displayNameOrOptions?.component;\n const displayName = passedDisplayName || Component.displayName || Component.name || 'Component';\n Component.displayName = displayName;\n\n const options = typeof displayNameOrOptions === 'string' ? undefined : displayNameOrOptions;\n\n const HOC = (props: Without<P, 'ternsecure'>) => {\n useAssertWrappedByTernSecureAuthProvider(displayName || 'withTernSecure');\n\n const ternsecure = useIsoTernSecureAuthCtx();\n\n if (!ternsecure.isReady && !options?.renderWhileLoading) {\n return null;\n }\n\n return (\n <Component\n {...(props as P)}\n component={displayName}\n ternsecure={ternsecure}\n />\n );\n };\n\n HOC.displayName = `withTernSecure(${displayName})`;\n return HOC;\n};\n"],"mappings":"AA2BM,cAAAA,MAAA,oBAxBN,OAAS,2BAAAC,MAA+B,iCACxC,OAAS,4CAAAC,MAAgD,8CAGlD,MAAMC,EAAiB,CAC5BC,EACAC,IACG,CAEH,MAAMC,GADoB,OAAOD,GAAyB,SAAWA,EAAuBA,GAAsB,YACzED,EAAU,aAAeA,EAAU,MAAQ,YACpFA,EAAU,YAAcE,EAExB,MAAMC,EAAU,OAAOF,GAAyB,SAAW,OAAYA,EAEjEG,EAAOC,GAAoC,CAC/CP,EAAyCI,GAAe,gBAAgB,EAExE,MAAMI,EAAaT,EAAwB,EAE3C,MAAI,CAACS,EAAW,SAAW,CAACH,GAAS,mBAC5B,KAIPP,EAACI,EAAA,CACE,GAAIK,EACL,UAAWH,EACX,WAAYI,EACd,CAEJ,EAEA,OAAAF,EAAI,YAAc,kBAAkBF,CAAW,IACxCE,CACT","names":["jsx","useIsoTernSecureAuthCtx","useAssertWrappedByTernSecureAuthProvider","withTernSecure","Component","displayNameOrOptions","displayName","options","HOC","props","ternsecure"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { DecodedIdToken, TernSecureUser } from '@tern-secure/types';
|
|
3
3
|
|
|
4
4
|
type AuthProviderCtxValue = {
|
|
@@ -6,7 +6,7 @@ type AuthProviderCtxValue = {
|
|
|
6
6
|
sessionClaims: DecodedIdToken | null | undefined;
|
|
7
7
|
user: TernSecureUser | null | undefined;
|
|
8
8
|
};
|
|
9
|
-
declare const AuthProviderCtx:
|
|
9
|
+
declare const AuthProviderCtx: React.Context<{
|
|
10
10
|
value: AuthProviderCtxValue;
|
|
11
11
|
} | undefined>;
|
|
12
12
|
declare const useAuthProviderCtx: () => AuthProviderCtxValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { DecodedIdToken, TernSecureUser } from '@tern-secure/types';
|
|
3
3
|
|
|
4
4
|
type AuthProviderCtxValue = {
|
|
@@ -6,7 +6,7 @@ type AuthProviderCtxValue = {
|
|
|
6
6
|
sessionClaims: DecodedIdToken | null | undefined;
|
|
7
7
|
user: TernSecureUser | null | undefined;
|
|
8
8
|
};
|
|
9
|
-
declare const AuthProviderCtx:
|
|
9
|
+
declare const AuthProviderCtx: React.Context<{
|
|
10
10
|
value: AuthProviderCtxValue;
|
|
11
11
|
} | undefined>;
|
|
12
12
|
declare const useAuthProviderCtx: () => AuthProviderCtxValue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import * as _tern_secure_types from '@tern-secure/types';
|
|
3
3
|
import { IsoTernSecureAuth } from '../lib/isoTernSecureAuth.mjs';
|
|
4
4
|
import '../types.mjs';
|
|
5
5
|
|
|
6
|
-
declare const IsoTernSecureAuthCtx:
|
|
6
|
+
declare const IsoTernSecureAuthCtx: React.Context<{
|
|
7
7
|
value: _tern_secure_types.TernSecureAuth;
|
|
8
8
|
} | undefined>;
|
|
9
9
|
declare const useIsoTernSecureAuthCtx: () => IsoTernSecureAuth;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import * as _tern_secure_types from '@tern-secure/types';
|
|
3
3
|
import { IsoTernSecureAuth } from '../lib/isoTernSecureAuth.js';
|
|
4
4
|
import '../types.js';
|
|
5
5
|
|
|
6
|
-
declare const IsoTernSecureAuthCtx:
|
|
6
|
+
declare const IsoTernSecureAuthCtx: React.Context<{
|
|
7
7
|
value: _tern_secure_types.TernSecureAuth;
|
|
8
8
|
} | undefined>;
|
|
9
9
|
declare const useIsoTernSecureAuthCtx: () => IsoTernSecureAuth;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { TernSecureInitialState, TernSecureResources } from '@tern-secure/types';
|
|
3
|
-
import
|
|
3
|
+
import React__default from 'react';
|
|
4
4
|
import { IsoTernSecureAuthOptions } from '../types.mjs';
|
|
5
5
|
|
|
6
6
|
type TernSecureCtxProviderProps = {
|
|
7
|
-
children:
|
|
7
|
+
children: React__default.ReactNode;
|
|
8
8
|
instanceOptions: IsoTernSecureAuthOptions;
|
|
9
9
|
initialState: TernSecureInitialState | undefined;
|
|
10
10
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { TernSecureInitialState, TernSecureResources } from '@tern-secure/types';
|
|
3
|
-
import
|
|
3
|
+
import React__default from 'react';
|
|
4
4
|
import { IsoTernSecureAuthOptions } from '../types.js';
|
|
5
5
|
|
|
6
6
|
type TernSecureCtxProviderProps = {
|
|
7
|
-
children:
|
|
7
|
+
children: React__default.ReactNode;
|
|
8
8
|
instanceOptions: IsoTernSecureAuthOptions;
|
|
9
9
|
initialState: TernSecureInitialState | undefined;
|
|
10
10
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var x=Object.create;var o=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var n in e)o(t,n,{get:e[n],enumerable:!0})},
|
|
1
|
+
"use strict";"use client";var x=Object.create;var o=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var n in e)o(t,n,{get:e[n],enumerable:!0})},v=(t,e,n,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of O(e))!E.call(t,s)&&s!==n&&o(t,s,{get:()=>e[s],enumerable:!(u=y(e,s))||u.enumerable});return t};var z=(t,e,n)=>(n=t!=null?x(R(t)):{},v(e||!t||!t.__esModule?o(n,"default",{value:t,enumerable:!0}):n,t)),L=t=>v(o({},"__esModule",{value:!0}),t);var b={};g(b,{TernSecureCtxProvider:()=>M});module.exports=L(b);var c=require("react/jsx-runtime"),h=require("@tern-secure/shared/derivedAuthState"),r=z(require("react")),i=require("../lib/isoTernSecureAuth"),T=require("./AuthProvider"),l=require("./IsomorphicTernSecureCtx");function M(t){const{children:e,initialState:n,instanceOptions:u}=t,{isoTernSecureAuth:s,instanceStatus:m}=N(u),[f,A]=(0,r.useState)({user:s.user,session:s.currentSession});r.default.useEffect(()=>s.addListener(p=>A({...p})),[]);const C=(0,h.deriveAuthState)(f,n),{sessionClaims:a,user:S,userId:d}=C,I=(0,r.useMemo)(()=>({value:{userId:d,user:S,sessionClaims:a}}),[d,S,a]),P=(0,r.useMemo)(()=>({value:s}),[m]);return(0,c.jsx)(l.IsoTernSecureAuthCtx.Provider,{value:P,children:(0,c.jsx)(T.AuthProviderCtx.Provider,{value:I,children:e})})}const N=t=>{const e=(0,r.useMemo)(()=>i.IsoTernSecureAuth.getOrCreateInstance(t),[]),[n,u]=(0,r.useState)(e.status);return(0,r.useEffect)(()=>(e.on("status",u),()=>e.off("status",u)),[e]),(0,r.useEffect)(()=>{e.initialize()},[e]),(0,r.useEffect)(()=>()=>{i.IsoTernSecureAuth.clearInstance()},[]),{isoTernSecureAuth:e,instanceStatus:n}};0&&(module.exports={TernSecureCtxProvider});
|
|
2
2
|
//# sourceMappingURL=TernSecureCtxProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ctx/TernSecureCtxProvider.tsx"],"sourcesContent":["'use client';\n\nimport { deriveAuthState } from '@tern-secure/shared/derivedAuthState';\nimport type { TernSecureInitialState, TernSecureResources } from '@tern-secure/types';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { IsoTernSecureAuth } from '../lib/isoTernSecureAuth';\nimport type { IsoTernSecureAuthOptions } from '../types';\nimport { AuthProviderCtx } from './AuthProvider';\nimport { IsoTernSecureAuthCtx } from './IsomorphicTernSecureCtx';\n\ntype TernSecureCtxProviderProps = {\n children: React.ReactNode;\n instanceOptions: IsoTernSecureAuthOptions;\n initialState: TernSecureInitialState | undefined;\n};\n\nexport type TernSecureCtxProviderState = TernSecureResources;\n\nexport function TernSecureCtxProvider(props: TernSecureCtxProviderProps) {\n const { children, initialState, instanceOptions } = props;\n
|
|
1
|
+
{"version":3,"sources":["../../src/ctx/TernSecureCtxProvider.tsx"],"sourcesContent":["'use client';\n\nimport { deriveAuthState } from '@tern-secure/shared/derivedAuthState';\nimport type { TernSecureInitialState, TernSecureResources } from '@tern-secure/types';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { IsoTernSecureAuth } from '../lib/isoTernSecureAuth';\nimport type { IsoTernSecureAuthOptions } from '../types';\nimport { AuthProviderCtx } from './AuthProvider';\nimport { IsoTernSecureAuthCtx } from './IsomorphicTernSecureCtx';\n\ntype TernSecureCtxProviderProps = {\n children: React.ReactNode;\n instanceOptions: IsoTernSecureAuthOptions;\n initialState: TernSecureInitialState | undefined;\n};\n\nexport type TernSecureCtxProviderState = TernSecureResources;\n\nexport function TernSecureCtxProvider(props: TernSecureCtxProviderProps) {\n const { children, initialState, instanceOptions } = props;\n const { isoTernSecureAuth: instance, instanceStatus } = useInitTernSecureAuth(instanceOptions);\n\n const [authState, setAuthState] = useState<TernSecureCtxProviderState>({\n user: instance.user,\n session: instance.currentSession,\n });\n\n React.useEffect(() => {\n return instance.addListener(e => setAuthState({ ...e }));\n }, []);\n\n const derivedState = deriveAuthState(authState, initialState);\n const { sessionClaims, user, userId } = derivedState;\n\n const authCtx = useMemo(() => {\n const value = {\n userId: userId,\n user: user,\n sessionClaims: sessionClaims,\n };\n return { value };\n }, [userId, user, sessionClaims]);\n\n const ternAuthCtx = useMemo(\n () => ({ value: instance}),[instanceStatus],\n );\n\n return (\n <IsoTernSecureAuthCtx.Provider value={ternAuthCtx}>\n <AuthProviderCtx.Provider value={authCtx}>{children}</AuthProviderCtx.Provider>\n </IsoTernSecureAuthCtx.Provider>\n );\n}\n\nconst useInitTernSecureAuth = (options: IsoTernSecureAuthOptions) => {\n const isoTernSecureAuth = useMemo(() => {\n return IsoTernSecureAuth.getOrCreateInstance(options);\n }, []);\n\n const [instanceStatus, setInstanceStatus] = useState(isoTernSecureAuth.status);\n\n useEffect(() => {\n void isoTernSecureAuth.on('status', setInstanceStatus);\n return () => isoTernSecureAuth.off('status', setInstanceStatus);\n }, [isoTernSecureAuth]);\n\n useEffect(() => {\n void isoTernSecureAuth.initialize();\n }, [isoTernSecureAuth]);\n\n useEffect(() => {\n return () => {\n IsoTernSecureAuth.clearInstance();\n };\n }, []);\n\n return {\n isoTernSecureAuth,\n instanceStatus,\n };\n};\n"],"mappings":"ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAkDM,IAAAI,EAAA,6BAhDNC,EAAgC,gDAEhCC,EAAoD,oBAEpDC,EAAkC,oCAElCC,EAAgC,0BAChCC,EAAqC,qCAU9B,SAASP,EAAsBQ,EAAmC,CACvE,KAAM,CAAE,SAAAC,EAAU,aAAAC,EAAc,gBAAAC,CAAgB,EAAIH,EAC9C,CAAE,kBAAmBI,EAAU,eAAAC,CAAe,EAAIC,EAAsBH,CAAe,EAEvF,CAACI,EAAWC,CAAY,KAAI,YAAqC,CACrE,KAAMJ,EAAS,KACf,QAASA,EAAS,cACpB,CAAC,EAED,EAAAK,QAAM,UAAU,IACPL,EAAS,YAAYM,GAAKF,EAAa,CAAE,GAAGE,CAAE,CAAC,CAAC,EACtD,CAAC,CAAC,EAEL,MAAMC,KAAe,mBAAgBJ,EAAWL,CAAY,EACtD,CAAE,cAAAU,EAAe,KAAAC,EAAM,OAAAC,CAAO,EAAIH,EAElCI,KAAU,WAAQ,KAMf,CAAE,MALK,CACZ,OAAQD,EACR,KAAMD,EACN,cAAeD,CACjB,CACe,GACd,CAACE,EAAQD,EAAMD,CAAa,CAAC,EAE1BI,KAAc,WAClB,KAAO,CAAE,MAAOZ,CAAQ,GAAG,CAACC,CAAc,CAC5C,EAEA,SACE,OAAC,uBAAqB,SAArB,CAA8B,MAAOW,EACpC,mBAAC,kBAAgB,SAAhB,CAAyB,MAAOD,EAAU,SAAAd,EAAS,EACtD,CAEJ,CAEA,MAAMK,EAAyBW,GAAsC,CACnE,MAAMC,KAAoB,WAAQ,IACzB,oBAAkB,oBAAoBD,CAAO,EACnD,CAAC,CAAC,EAEC,CAACZ,EAAgBc,CAAiB,KAAI,YAASD,EAAkB,MAAM,EAE7E,sBAAU,KACHA,EAAkB,GAAG,SAAUC,CAAiB,EAC9C,IAAMD,EAAkB,IAAI,SAAUC,CAAiB,GAC7D,CAACD,CAAiB,CAAC,KAEtB,aAAU,IAAM,CACTA,EAAkB,WAAW,CACpC,EAAG,CAACA,CAAiB,CAAC,KAEtB,aAAU,IACD,IAAM,CACX,oBAAkB,cAAc,CAClC,EACC,CAAC,CAAC,EAEE,CACL,kBAAAA,EACA,eAAAb,CACF,CACF","names":["TernSecureCtxProvider_exports","__export","TernSecureCtxProvider","__toCommonJS","import_jsx_runtime","import_derivedAuthState","import_react","import_isoTernSecureAuth","import_AuthProvider","import_IsomorphicTernSecureCtx","props","children","initialState","instanceOptions","instance","instanceStatus","useInitTernSecureAuth","authState","setAuthState","React","e","derivedState","sessionClaims","user","userId","authCtx","ternAuthCtx","options","isoTernSecureAuth","setInstanceStatus"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as v}from"react/jsx-runtime";import{deriveAuthState as C}from"@tern-secure/shared/derivedAuthState";import I,{useEffect as u,useMemo as o,useState as d}from"react";import{IsoTernSecureAuth as p}from"../lib/isoTernSecureAuth";import{AuthProviderCtx as P}from"./AuthProvider";import{IsoTernSecureAuthCtx as x}from"./IsomorphicTernSecureCtx";function L(n){const{children:e,initialState:s,instanceOptions:t}=n,{isoTernSecureAuth:r,instanceStatus:h}=y(t),[T,l]=d({user:r.user,session:r.currentSession});I.useEffect(()=>r.addListener(S=>l({...S})),[]);const m=C(T,s),{sessionClaims:i,user:c,userId:a}=m,f=o(()=>({value:{userId:a,user:c,sessionClaims:i}}),[a,c,i]),A=o(()=>({value:r}),[h]);return v(x.Provider,{value:A,children:v(P.Provider,{value:f,children:e})})}const y=n=>{const e=o(()=>p.getOrCreateInstance(n),[]),[s,t]=d(e.status);return u(()=>(e.on("status",t),()=>e.off("status",t)),[e]),u(()=>{e.initialize()},[e]),u(()=>()=>{p.clearInstance()},[]),{isoTernSecureAuth:e,instanceStatus:s}};export{L as TernSecureCtxProvider};
|
|
2
2
|
//# sourceMappingURL=TernSecureCtxProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ctx/TernSecureCtxProvider.tsx"],"sourcesContent":["'use client';\n\nimport { deriveAuthState } from '@tern-secure/shared/derivedAuthState';\nimport type { TernSecureInitialState, TernSecureResources } from '@tern-secure/types';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { IsoTernSecureAuth } from '../lib/isoTernSecureAuth';\nimport type { IsoTernSecureAuthOptions } from '../types';\nimport { AuthProviderCtx } from './AuthProvider';\nimport { IsoTernSecureAuthCtx } from './IsomorphicTernSecureCtx';\n\ntype TernSecureCtxProviderProps = {\n children: React.ReactNode;\n instanceOptions: IsoTernSecureAuthOptions;\n initialState: TernSecureInitialState | undefined;\n};\n\nexport type TernSecureCtxProviderState = TernSecureResources;\n\nexport function TernSecureCtxProvider(props: TernSecureCtxProviderProps) {\n const { children, initialState, instanceOptions } = props;\n
|
|
1
|
+
{"version":3,"sources":["../../src/ctx/TernSecureCtxProvider.tsx"],"sourcesContent":["'use client';\n\nimport { deriveAuthState } from '@tern-secure/shared/derivedAuthState';\nimport type { TernSecureInitialState, TernSecureResources } from '@tern-secure/types';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { IsoTernSecureAuth } from '../lib/isoTernSecureAuth';\nimport type { IsoTernSecureAuthOptions } from '../types';\nimport { AuthProviderCtx } from './AuthProvider';\nimport { IsoTernSecureAuthCtx } from './IsomorphicTernSecureCtx';\n\ntype TernSecureCtxProviderProps = {\n children: React.ReactNode;\n instanceOptions: IsoTernSecureAuthOptions;\n initialState: TernSecureInitialState | undefined;\n};\n\nexport type TernSecureCtxProviderState = TernSecureResources;\n\nexport function TernSecureCtxProvider(props: TernSecureCtxProviderProps) {\n const { children, initialState, instanceOptions } = props;\n const { isoTernSecureAuth: instance, instanceStatus } = useInitTernSecureAuth(instanceOptions);\n\n const [authState, setAuthState] = useState<TernSecureCtxProviderState>({\n user: instance.user,\n session: instance.currentSession,\n });\n\n React.useEffect(() => {\n return instance.addListener(e => setAuthState({ ...e }));\n }, []);\n\n const derivedState = deriveAuthState(authState, initialState);\n const { sessionClaims, user, userId } = derivedState;\n\n const authCtx = useMemo(() => {\n const value = {\n userId: userId,\n user: user,\n sessionClaims: sessionClaims,\n };\n return { value };\n }, [userId, user, sessionClaims]);\n\n const ternAuthCtx = useMemo(\n () => ({ value: instance}),[instanceStatus],\n );\n\n return (\n <IsoTernSecureAuthCtx.Provider value={ternAuthCtx}>\n <AuthProviderCtx.Provider value={authCtx}>{children}</AuthProviderCtx.Provider>\n </IsoTernSecureAuthCtx.Provider>\n );\n}\n\nconst useInitTernSecureAuth = (options: IsoTernSecureAuthOptions) => {\n const isoTernSecureAuth = useMemo(() => {\n return IsoTernSecureAuth.getOrCreateInstance(options);\n }, []);\n\n const [instanceStatus, setInstanceStatus] = useState(isoTernSecureAuth.status);\n\n useEffect(() => {\n void isoTernSecureAuth.on('status', setInstanceStatus);\n return () => isoTernSecureAuth.off('status', setInstanceStatus);\n }, [isoTernSecureAuth]);\n\n useEffect(() => {\n void isoTernSecureAuth.initialize();\n }, [isoTernSecureAuth]);\n\n useEffect(() => {\n return () => {\n IsoTernSecureAuth.clearInstance();\n };\n }, []);\n\n return {\n isoTernSecureAuth,\n instanceStatus,\n };\n};\n"],"mappings":"aAkDM,cAAAA,MAAA,oBAhDN,OAAS,mBAAAC,MAAuB,uCAEhC,OAAOC,GAAS,aAAAC,EAAW,WAAAC,EAAS,YAAAC,MAAgB,QAEpD,OAAS,qBAAAC,MAAyB,2BAElC,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,wBAAAC,MAA4B,4BAU9B,SAASC,EAAsBC,EAAmC,CACvE,KAAM,CAAE,SAAAC,EAAU,aAAAC,EAAc,gBAAAC,CAAgB,EAAIH,EAC9C,CAAE,kBAAmBI,EAAU,eAAAC,CAAe,EAAIC,EAAsBH,CAAe,EAEvF,CAACI,EAAWC,CAAY,EAAIb,EAAqC,CACrE,KAAMS,EAAS,KACf,QAASA,EAAS,cACpB,CAAC,EAEDZ,EAAM,UAAU,IACPY,EAAS,YAAYK,GAAKD,EAAa,CAAE,GAAGC,CAAE,CAAC,CAAC,EACtD,CAAC,CAAC,EAEL,MAAMC,EAAenB,EAAgBgB,EAAWL,CAAY,EACtD,CAAE,cAAAS,EAAe,KAAAC,EAAM,OAAAC,CAAO,EAAIH,EAElCI,EAAUpB,EAAQ,KAMf,CAAE,MALK,CACZ,OAAQmB,EACR,KAAMD,EACN,cAAeD,CACjB,CACe,GACd,CAACE,EAAQD,EAAMD,CAAa,CAAC,EAE1BI,EAAcrB,EAClB,KAAO,CAAE,MAAOU,CAAQ,GAAG,CAACC,CAAc,CAC5C,EAEA,OACEf,EAACQ,EAAqB,SAArB,CAA8B,MAAOiB,EACpC,SAAAzB,EAACO,EAAgB,SAAhB,CAAyB,MAAOiB,EAAU,SAAAb,EAAS,EACtD,CAEJ,CAEA,MAAMK,EAAyBU,GAAsC,CACnE,MAAMC,EAAoBvB,EAAQ,IACzBE,EAAkB,oBAAoBoB,CAAO,EACnD,CAAC,CAAC,EAEC,CAACX,EAAgBa,CAAiB,EAAIvB,EAASsB,EAAkB,MAAM,EAE7E,OAAAxB,EAAU,KACHwB,EAAkB,GAAG,SAAUC,CAAiB,EAC9C,IAAMD,EAAkB,IAAI,SAAUC,CAAiB,GAC7D,CAACD,CAAiB,CAAC,EAEtBxB,EAAU,IAAM,CACTwB,EAAkB,WAAW,CACpC,EAAG,CAACA,CAAiB,CAAC,EAEtBxB,EAAU,IACD,IAAM,CACXG,EAAkB,cAAc,CAClC,EACC,CAAC,CAAC,EAEE,CACL,kBAAAqB,EACA,eAAAZ,CACF,CACF","names":["jsx","deriveAuthState","React","useEffect","useMemo","useState","IsoTernSecureAuth","AuthProviderCtx","IsoTernSecureAuthCtx","TernSecureCtxProvider","props","children","initialState","instanceOptions","instance","instanceStatus","useInitTernSecureAuth","authState","setAuthState","e","derivedState","sessionClaims","user","userId","authCtx","ternAuthCtx","options","isoTernSecureAuth","setInstanceStatus"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
import { TernSecureProviderProps } from '../types.mjs';
|
|
4
4
|
import '@tern-secure/types';
|
|
5
5
|
|
|
6
6
|
declare function TernSecureProviderBase(props: TernSecureProviderProps): react_jsx_runtime.JSX.Element;
|
|
7
|
-
declare const TernSecureProvider:
|
|
7
|
+
declare const TernSecureProvider: React__default.MemoExoticComponent<typeof TernSecureProviderBase>;
|
|
8
8
|
|
|
9
9
|
export { TernSecureProvider };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
import { TernSecureProviderProps } from '../types.js';
|
|
4
4
|
import '@tern-secure/types';
|
|
5
5
|
|
|
6
6
|
declare function TernSecureProviderBase(props: TernSecureProviderProps): react_jsx_runtime.JSX.Element;
|
|
7
|
-
declare const TernSecureProvider:
|
|
7
|
+
declare const TernSecureProvider: React__default.MemoExoticComponent<typeof TernSecureProviderBase>;
|
|
8
8
|
|
|
9
9
|
export { TernSecureProvider };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to access Firebase App Check instance and retrieve tokens
|
|
3
|
+
* @returns Object containing appCheck instance and getToken method
|
|
4
|
+
* @throws Error if TernSecure is not initialized or App Check is not configured
|
|
5
|
+
*/
|
|
6
|
+
declare const useAppCheck: () => {
|
|
7
|
+
appCheck: any;
|
|
8
|
+
getToken: (forceRefresh?: boolean) => Promise<string | undefined>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { useAppCheck };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to access Firebase App Check instance and retrieve tokens
|
|
3
|
+
* @returns Object containing appCheck instance and getToken method
|
|
4
|
+
* @throws Error if TernSecure is not initialized or App Check is not configured
|
|
5
|
+
*/
|
|
6
|
+
declare const useAppCheck: () => {
|
|
7
|
+
appCheck: any;
|
|
8
|
+
getToken: (forceRefresh?: boolean) => Promise<string | undefined>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { useAppCheck };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var l=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},m=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of k(e))!h.call(r,n)&&n!==t&&s(r,n,{get:()=>e[n],enumerable:!(o=u(e,n))||o.enumerable});return r};var C=r=>m(s({},"__esModule",{value:!0}),r);var f={};l(f,{useAppCheck:()=>a});module.exports=C(f);var i=require("@tern-secure/shared/react"),p=require("firebase/app-check"),c=require("react");const a=()=>{const e=(0,i.useTernSecure)().appCheck;if(!e)throw new Error("Firebase App Check not initialized in TernSecure instance");const t=(0,c.useCallback)(async(o=!1)=>{try{return(await(0,p.getToken)(e,o)).token}catch(n){console.warn("Failed to get App Check token:",n);return}},[e]);return(0,c.useMemo)(()=>({appCheck:e,getToken:t}),[e,t])};0&&(module.exports={useAppCheck});
|
|
2
|
+
//# sourceMappingURL=useAppCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useAppCheck.ts"],"sourcesContent":["'use client';\n\nimport { useTernSecure } from \"@tern-secure/shared/react\";\nimport { getToken } from 'firebase/app-check';\nimport { useCallback, useMemo } from 'react';\n\n/**\n * Hook to access Firebase App Check instance and retrieve tokens\n * @returns Object containing appCheck instance and getToken method\n * @throws Error if TernSecure is not initialized or App Check is not configured\n */\nconst useAppCheck = () => {\n const ternSecure = useTernSecure();\n const appCheckInstance = ternSecure.appCheck;\n\n if (!appCheckInstance) {\n throw new Error('Firebase App Check not initialized in TernSecure instance');\n }\n\n const getAppCheckToken = useCallback(async (forceRefresh = false): Promise<string | undefined> => {\n try {\n const result = await getToken(appCheckInstance, forceRefresh);\n return result.token;\n } catch (error) {\n console.warn('Failed to get App Check token:', error);\n return undefined;\n }\n }, [appCheckInstance]);\n\n return useMemo(() => ({\n appCheck: appCheckInstance,\n getToken: getAppCheckToken,\n }), [appCheckInstance, getAppCheckToken]);\n};\n\n\n\nexport { useAppCheck };"],"mappings":"sbAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAA8B,qCAC9BC,EAAyB,8BACzBD,EAAqC,iBAOrC,MAAMF,EAAc,IAAM,CAEtB,MAAMI,KADa,iBAAc,EACG,SAEpC,GAAI,CAACA,EACD,MAAM,IAAI,MAAM,2DAA2D,EAG/E,MAAMC,KAAmB,eAAY,MAAOC,EAAe,KAAuC,CAC9F,GAAI,CAEA,OADe,QAAM,YAASF,EAAkBE,CAAY,GAC9C,KAClB,OAASC,EAAO,CACZ,QAAQ,KAAK,iCAAkCA,CAAK,EACpD,MACJ,CACJ,EAAG,CAACH,CAAgB,CAAC,EAErB,SAAO,WAAQ,KAAO,CAClB,SAAUA,EACV,SAAUC,CACd,GAAI,CAACD,EAAkBC,CAAgB,CAAC,CAC5C","names":["useAppCheck_exports","__export","useAppCheck","__toCommonJS","import_react","import_app_check","appCheckInstance","getAppCheckToken","forceRefresh","error"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{useTernSecure as o}from"@tern-secure/shared/react";import{getToken as c}from"firebase/app-check";import{useCallback as s,useMemo as i}from"react";const p=()=>{const e=o().appCheck;if(!e)throw new Error("Firebase App Check not initialized in TernSecure instance");const r=s(async(t=!1)=>{try{return(await c(e,t)).token}catch(n){console.warn("Failed to get App Check token:",n);return}},[e]);return i(()=>({appCheck:e,getToken:r}),[e,r])};export{p as useAppCheck};
|
|
2
|
+
//# sourceMappingURL=useAppCheck.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useAppCheck.ts"],"sourcesContent":["'use client';\n\nimport { useTernSecure } from \"@tern-secure/shared/react\";\nimport { getToken } from 'firebase/app-check';\nimport { useCallback, useMemo } from 'react';\n\n/**\n * Hook to access Firebase App Check instance and retrieve tokens\n * @returns Object containing appCheck instance and getToken method\n * @throws Error if TernSecure is not initialized or App Check is not configured\n */\nconst useAppCheck = () => {\n const ternSecure = useTernSecure();\n const appCheckInstance = ternSecure.appCheck;\n\n if (!appCheckInstance) {\n throw new Error('Firebase App Check not initialized in TernSecure instance');\n }\n\n const getAppCheckToken = useCallback(async (forceRefresh = false): Promise<string | undefined> => {\n try {\n const result = await getToken(appCheckInstance, forceRefresh);\n return result.token;\n } catch (error) {\n console.warn('Failed to get App Check token:', error);\n return undefined;\n }\n }, [appCheckInstance]);\n\n return useMemo(() => ({\n appCheck: appCheckInstance,\n getToken: getAppCheckToken,\n }), [appCheckInstance, getAppCheckToken]);\n};\n\n\n\nexport { useAppCheck };"],"mappings":"aAEA,OAAS,iBAAAA,MAAqB,4BAC9B,OAAS,YAAAC,MAAgB,qBACzB,OAAS,eAAAC,EAAa,WAAAC,MAAe,QAOrC,MAAMC,EAAc,IAAM,CAEtB,MAAMC,EADaL,EAAc,EACG,SAEpC,GAAI,CAACK,EACD,MAAM,IAAI,MAAM,2DAA2D,EAG/E,MAAMC,EAAmBJ,EAAY,MAAOK,EAAe,KAAuC,CAC9F,GAAI,CAEA,OADe,MAAMN,EAASI,EAAkBE,CAAY,GAC9C,KAClB,OAASC,EAAO,CACZ,QAAQ,KAAK,iCAAkCA,CAAK,EACpD,MACJ,CACJ,EAAG,CAACH,CAAgB,CAAC,EAErB,OAAOF,EAAQ,KAAO,CAClB,SAAUE,EACV,SAAUC,CACd,GAAI,CAACD,EAAkBC,CAAgB,CAAC,CAC5C","names":["useTernSecure","getToken","useCallback","useMemo","useAppCheck","appCheckInstance","getAppCheckToken","forceRefresh","error"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
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 };
|
|
@@ -0,0 +1,6 @@
|
|
|
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 };
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { UseSignInReturn,
|
|
1
|
+
import { UseSignInReturn, SignInPasswordParams, SignInResponse, SocialProviderOptions, SignInVerificationResponse } from '@tern-secure/types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Hook to access the SignInResource methods from TernSecureAuth
|
|
@@ -6,9 +6,9 @@ import { UseSignInReturn, SignInFormValues, SignInResponse, SocialProviderOption
|
|
|
6
6
|
*/
|
|
7
7
|
declare const useSignIn: () => UseSignInReturn;
|
|
8
8
|
declare const signIn: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
authenticateWithPassword: (params: SignInPasswordParams) => Promise<SignInResponse>;
|
|
10
|
+
authenticateWithSocialProvider: (provider: string, customOptions: SocialProviderOptions) => Promise<SignInResponse | void>;
|
|
11
|
+
attemptEmailVerification: () => Promise<SignInVerificationResponse>;
|
|
12
12
|
checkRedirectResult: () => Promise<SignInResponse | null>;
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseSignInReturn,
|
|
1
|
+
import { UseSignInReturn, SignInPasswordParams, SignInResponse, SocialProviderOptions, SignInVerificationResponse } from '@tern-secure/types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Hook to access the SignInResource methods from TernSecureAuth
|
|
@@ -6,9 +6,9 @@ import { UseSignInReturn, SignInFormValues, SignInResponse, SocialProviderOption
|
|
|
6
6
|
*/
|
|
7
7
|
declare const useSignIn: () => UseSignInReturn;
|
|
8
8
|
declare const signIn: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
authenticateWithPassword: (params: SignInPasswordParams) => Promise<SignInResponse>;
|
|
10
|
+
authenticateWithSocialProvider: (provider: string, customOptions: SocialProviderOptions) => Promise<SignInResponse | void>;
|
|
11
|
+
attemptEmailVerification: () => Promise<SignInVerificationResponse>;
|
|
12
12
|
checkRedirectResult: () => Promise<SignInResponse | null>;
|
|
13
13
|
};
|
|
14
14
|
|