@auth0/auth0-acul-react
Advanced tools
| /** | ||
| * Result object returned by {@link usePasskeyAutofill}. | ||
| * | ||
| * Provides a ref that can be attached to the username `<input>` element | ||
| * to automatically enable browser Conditional UI (passkey autofill). | ||
| * | ||
| * @see {@link usePasskeyAutofill} | ||
| * @category Passkeys | ||
| * @public | ||
| */ | ||
| export interface UsePasskeyAutofillResult { | ||
| /** | ||
| * A React ref that can be bound to the username `<input>` element. | ||
| * | ||
| * When attached, the SDK ensures the inputβs `autocomplete` | ||
| * attribute is correctly set to `"username webauthn"`. | ||
| * | ||
| * If the developer already declared this attribute in markup, | ||
| * the ref is optional, the hook will still register Conditional | ||
| * Mediation correctly even without it. | ||
| */ | ||
| inputRef: React.RefObject<HTMLInputElement>; | ||
| } | ||
| /** | ||
| * React hook that enables browser **Conditional UI** (passkey autofill) | ||
| * for the login identifier field on the `login-id` screen. | ||
| * | ||
| * --- | ||
| * ### Behavior | ||
| * - The hook automatically initializes the browserβs Conditional Mediation | ||
| * API (`navigator.credentials.get({ mediation: "conditional" })`), | ||
| * allowing passkeys stored on the userβs device to appear directly in | ||
| * the username fieldβs autocomplete dropdown. | ||
| * - It **fails silently** on unsupported browsers and **never blocks** user input. | ||
| * - The registration is performed once per page lifecycle. | ||
| * | ||
| * --- | ||
| * ### Using the returned `ref` | ||
| * The returned `inputRef` is **optional**. | ||
| * - If you bind it to your `<input>` element, the SDK will ensure the elementβs | ||
| * `autocomplete` attribute is correctly set to `"username webauthn"`. | ||
| * - If your input element **already has** | ||
| * `autocomplete="username webauthn"` declared in markup, | ||
| * you can skip binding the `ref` entirely, the hook will still register | ||
| * Conditional Mediation correctly. See {@link UsePasskeyAutofillResult} | ||
| * | ||
| * --- | ||
| * ### Example | ||
| * ```tsx | ||
| * import { usePasskeyAutofill } from '@auth0/auth0-acul-react/login-id'; | ||
| * | ||
| * export function LoginForm() { | ||
| * // Option 1: bind the ref for automatic attribute handling | ||
| * const { inputRef } = usePasskeyAutofill(); | ||
| * | ||
| * return ( | ||
| * <input | ||
| * ref={inputRef} | ||
| * id="username" | ||
| * placeholder="Username" | ||
| * autoComplete="username webauthn" | ||
| * /> | ||
| * ); | ||
| * } | ||
| * | ||
| * // Option 2: works equally well without using the ref | ||
| * export function LoginFormWithoutRef() { | ||
| * usePasskeyAutofill(); // just call the hook once | ||
| * | ||
| * return ( | ||
| * <input | ||
| * id="username" | ||
| * placeholder="Username" | ||
| * autoComplete="username webauthn" | ||
| * /> | ||
| * ); | ||
| * } | ||
| * ``` | ||
| * | ||
| * --- | ||
| * @supportedScreens | ||
| * - `login-id` | ||
| * | ||
| * @category Passkeys | ||
| */ | ||
| export declare function usePasskeyAutofill(): UsePasskeyAutofillResult; |
| import{useRef as t,useLayoutEffect as e}from"react";import{getScreen as r}from"../../state/instance-store.js";const o="username webauthn";function n(){const n=r(),s=t(null),i=t(!1);return e(()=>{if(!i.current){i.current=!0;try{if(!n||"function"!=typeof n.registerPasskeyAutofill)return void console.warn("Passkey autofill unavailable: missing instance method");const t=s.current,e=t?.id;if(n.registerPasskeyAutofill(e),t){(t.getAttribute("autocomplete")??"").trim().toLowerCase()!==o&&t.setAttribute("autocomplete",o)}}catch(t){console.warn("usePasskeyAutofill failed:",t)}}},[n]),{inputRef:s}}export{n as usePasskeyAutofill}; | ||
| //# sourceMappingURL=passkey-autofill.js.map |
| {"version":3,"file":"passkey-autofill.js","sources":["../../../src/hooks/utility/passkey-autofill.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react';\n\nimport { getScreen } from '../../state/instance-store';\n\nimport type { LoginIdMembers } from '@auth0/auth0-acul-js/login-id';\n\nconst REQUIRED_TOKENS = 'username webauthn';\n\n/**\n * Result object returned by {@link usePasskeyAutofill}.\n *\n * Provides a ref that can be attached to the username `<input>` element\n * to automatically enable browser Conditional UI (passkey autofill).\n *\n * @see {@link usePasskeyAutofill}\n * @category Passkeys\n * @public\n */\nexport interface UsePasskeyAutofillResult {\n /**\n * A React ref that can be bound to the username `<input>` element.\n *\n * When attached, the SDK ensures the inputβs `autocomplete`\n * attribute is correctly set to `\"username webauthn\"`.\n *\n * If the developer already declared this attribute in markup,\n * the ref is optional, the hook will still register Conditional\n * Mediation correctly even without it.\n */\n inputRef: React.RefObject<HTMLInputElement>;\n}\n\n/**\n * React hook that enables browser **Conditional UI** (passkey autofill)\n * for the login identifier field on the `login-id` screen.\n *\n * ---\n * ### Behavior\n * - The hook automatically initializes the browserβs Conditional Mediation\n * API (`navigator.credentials.get({ mediation: \"conditional\" })`),\n * allowing passkeys stored on the userβs device to appear directly in\n * the username fieldβs autocomplete dropdown.\n * - It **fails silently** on unsupported browsers and **never blocks** user input.\n * - The registration is performed once per page lifecycle.\n *\n * ---\n * ### Using the returned `ref`\n * The returned `inputRef` is **optional**.\n * - If you bind it to your `<input>` element, the SDK will ensure the elementβs\n * `autocomplete` attribute is correctly set to `\"username webauthn\"`.\n * - If your input element **already has**\n * `autocomplete=\"username webauthn\"` declared in markup,\n * you can skip binding the `ref` entirely, the hook will still register\n * Conditional Mediation correctly. See {@link UsePasskeyAutofillResult}\n *\n * ---\n * ### Example\n * ```tsx\n * import { usePasskeyAutofill } from '@auth0/auth0-acul-react/login-id';\n *\n * export function LoginForm() {\n * // Option 1: bind the ref for automatic attribute handling\n * const { inputRef } = usePasskeyAutofill();\n *\n * return (\n * <input\n * ref={inputRef}\n * id=\"username\"\n * placeholder=\"Username\"\n * autoComplete=\"username webauthn\"\n * />\n * );\n * }\n *\n * // Option 2: works equally well without using the ref\n * export function LoginFormWithoutRef() {\n * usePasskeyAutofill(); // just call the hook once\n *\n * return (\n * <input\n * id=\"username\"\n * placeholder=\"Username\"\n * autoComplete=\"username webauthn\"\n * />\n * );\n * }\n * ```\n *\n * ---\n * @supportedScreens\n * - `login-id`\n *\n * @category Passkeys\n */\nexport function usePasskeyAutofill(): UsePasskeyAutofillResult {\n const instance = getScreen<LoginIdMembers>();\n const inputRef = useRef<HTMLInputElement>(null);\n const initializedRef = useRef(false);\n\n useLayoutEffect(() => {\n if (initializedRef.current) return;\n initializedRef.current = true;\n\n try {\n if (!instance || typeof instance.registerPasskeyAutofill !== 'function') {\n console.warn('Passkey autofill unavailable: missing instance method');\n return;\n }\n\n const el = inputRef.current;\n const inputId = el?.id;\n\n // Fire-and-forget registration (fails silently)\n void instance.registerPasskeyAutofill(inputId);\n\n // Optionally correct the autocomplete attribute if the ref was used\n if (el) {\n const current = (el.getAttribute('autocomplete') ?? '').trim().toLowerCase();\n if (current !== REQUIRED_TOKENS) {\n el.setAttribute('autocomplete', REQUIRED_TOKENS);\n }\n }\n } catch (err) {\n console.warn('usePasskeyAutofill failed:', err);\n }\n }, [instance]);\n\n return { inputRef };\n}\n"],"names":["REQUIRED_TOKENS","usePasskeyAutofill","instance","getScreen","inputRef","useRef","initializedRef","useLayoutEffect","current","registerPasskeyAutofill","console","warn","el","inputId","id","getAttribute","trim","toLowerCase","setAttribute","err"],"mappings":"8GAMA,MAAMA,EAAkB,6BAwFRC,IACd,MAAMC,EAAWC,IACXC,EAAWC,EAAyB,MACpCC,EAAiBD,GAAO,GA8B9B,OA5BAE,EAAgB,KACd,IAAID,EAAeE,QAAnB,CACAF,EAAeE,SAAU,EAEzB,IACE,IAAKN,GAAwD,mBAArCA,EAASO,wBAE/B,YADAC,QAAQC,KAAK,yDAIf,MAAMC,EAAKR,EAASI,QACdK,EAAUD,GAAIE,GAMpB,GAHKZ,EAASO,wBAAwBI,GAGlCD,EAAI,EACWA,EAAGG,aAAa,iBAAmB,IAAIC,OAAOC,gBAC/CjB,GACdY,EAAGM,aAAa,eAAgBlB,EAEpC,CACF,CAAE,MAAOmB,GACPT,QAAQC,KAAK,6BAA8BQ,EAC7C,CAxB4B,GAyB3B,CAACjB,IAEG,CAAEE,WACX"} |
@@ -211,3 +211,3 @@ /** | ||
| * - `useErrors(options)` - Comprehensive error management with categorization | ||
| * - Filter by error kind: `'client'`, `'server'`, `'dev'` | ||
| * - Filter by error kind: `'validation'`, `'auth0'`, `'configuration'` | ||
| * - Filter by field name for form-specific errors | ||
@@ -214,0 +214,0 @@ * - Dismiss individual or all errors |
@@ -1,1 +0,1 @@ | ||
| export { usePasswordValidation, useUsernameValidation, useResend, useMfaPolling, useErrors, useAuth0Themes, useCurrentScreen, useLoginIdentifiers, useSignupIdentifiers, } from '../hooks'; | ||
| export { usePasswordValidation, useUsernameValidation, useResend, useMfaPolling, useErrors, useAuth0Themes, useCurrentScreen, useLoginIdentifiers, useSignupIdentifiers, usePasskeyAutofill, } from '../hooks'; |
@@ -22,5 +22,5 @@ import { type ErrorItem, type ErrorKind } from '../../state/error-store'; | ||
| * With all validation and server-side errors. It groups errors into three kinds: | ||
| * - `server` β errors returned by Auth0 or your own backend. | ||
| * - `client` β errors from client-side validation (e.g., invalid form input). | ||
| * - `developer` β errors caused by incorrect integration or SDK misuse. | ||
| * - `auth0` β errors returned by Auth0 or your own backend. | ||
| * - `validation` β errors from client-side validation (e.g., invalid form input). | ||
| * - `configuration` β errors caused by incorrect integration or SDK misuse. | ||
| * | ||
@@ -30,3 +30,3 @@ * @supportedScreens | ||
| * | ||
| * @param options.includeDevErrors - When `true`, developer errors are included in | ||
| * @param options.includeDevErrors - When `true`, configuration errors are included in | ||
| * the returned list. Defaults to `false`. | ||
@@ -56,3 +56,3 @@ * | ||
| * <div className="mb-4"> | ||
| * {errors.byKind("server").map(err => ( | ||
| * {errors.byKind("auth0").map(err => ( | ||
| * <div key={err.id} className="text-red-600"> | ||
@@ -74,6 +74,6 @@ * {err.message} | ||
| * ```ts | ||
| * console.log(errors.byKind('client')); // all client errors | ||
| * console.log(errors.byKind('client', { field: 'username' })); // client errors for field 'username' | ||
| * console.log(errors.byKind('validation')); // all validation errors | ||
| * console.log(errors.byKind('validation', { field: 'username' })); // validation errors for field 'username' | ||
| * console.log(errors.byField('username')); // all errors for field 'username' | ||
| * console.log(errors.byField('username', { kind: 'server' })); // server errors for field 'username' | ||
| * console.log(errors.byField('username', { kind: 'auth0' })); // auth0 errors for field 'username' | ||
| * ``` | ||
@@ -90,7 +90,7 @@ */ | ||
| withError: typeof withError; | ||
| replaceClientErrors(list: Array<Omit<ErrorItem, "id">>, opts?: { | ||
| replaceValidationErrors(list: Array<Omit<ErrorItem, "id">>, opts?: { | ||
| byField?: string; | ||
| }): void; | ||
| clearClientErrors(): void; | ||
| pushClientErrors(list: Omit<ErrorItem, "id"> | Array<Omit<ErrorItem, "id">>): void; | ||
| clearValidationErrors(): void; | ||
| pushValidationErrors(list: Omit<ErrorItem, "id"> | Array<Omit<ErrorItem, "id">>): void; | ||
| replaceDeveloperErrors(list: Array<Omit<ErrorItem, "id">>, opts?: { | ||
@@ -97,0 +97,0 @@ byField?: string; |
@@ -1,2 +0,2 @@ | ||
| import{getErrors as e,UserInputError as r,SDKUsageError as t,Auth0ServerError as n}from"@auth0/auth0-acul-js";import{useSyncExternalStore as c,useRef as o,useEffect as l,useMemo as s,useCallback as i}from"react";import{errorStore as a,ERROR_KINDS as p}from"../../state/error-store.js";function d(e,r){return r?e.filter(e=>e.field===r):e}const u=new WeakMap,v=new WeakMap,f=new WeakMap,h=(e,r)=>{const t="server"===e?u:"client"===e?v:f,n=t.get(r);if(n)return n;const c=Object.freeze(r.map(r=>Object.freeze({...r,kind:e})));return t.set(r,c),c};function b(r={}){const{includeDevErrors:t=!1}=r,n=c(e=>a.subscribe(e),()=>a.snapshot()),u=o(!1);l(()=>{if(u.current)return;u.current=!0;const r=e?.()??[];a.replace("server",r)},[]);const v=s(()=>h("server",n.server),[n.server]),f=s(()=>h("client",n.client),[n.client]),b=s(()=>h("developer",n.developer),[n.developer]),E=s(()=>Object.freeze([...t?b:[],...f,...v]),[t,b,f,v]),y=s(()=>{const e=Object.assign([...E],{byKind(e,r){const t="client"===e?f:"developer"===e?b:v;return r?.field?Object.freeze(d(t,r.field)):t},byField:(r,t)=>t?.kind?e.byKind(t.kind,{field:r}):Object.freeze(d(E,r))});return Object.freeze(e)},[E,f,b,v]),m=E.length>0,k=i(e=>{a.remove(p,e)},[]),w=i(()=>{a.clear(p)},[]);return s(()=>({errors:y,hasError:m,dismiss:k,dismissAll:w}),[y,m,k,w])}const E={withError:function(e){const c=e=>{const c=function(e){return e instanceof r?"client":e instanceof t?"developer":e instanceof n?"server":null}(e),o=function(e){return{code:e?.code??(e instanceof Error?e.name:void 0)??"unknown_error",message:e?.message??"Unknown error",field:e?.field}}(e);switch(c){case"client":E.replaceClientErrors([o]);break;case"developer":E.replaceDeveloperErrors([o]);break;case"server":E.replaceServerErrors([o]);break;default:throw console.error("[auth0-acul-react] Unhandled error:",e),e}};if("function"==typeof e)try{const r=e();return"object"==typeof(o=r)&&null!==o&&"then"in o&&"function"==typeof o.then?r.catch(e=>{throw c(e),e}):r}catch(e){throw c(e),e}var o;return e.catch(e=>{throw c(e),e})},replaceClientErrors(e,r){r?.byField?a.replacePartial("client",e,r.byField):a.replace("client",e)},clearClientErrors(){a.clear(["client"])},pushClientErrors(e){a.push("client",e)},replaceDeveloperErrors(e,r){r?.byField?a.replacePartial("developer",e,r.byField):a.replace("developer",e)},clearDeveloperErrors(){a.clear(["developer"])},pushDeveloperErrors(e){a.push("developer",e)},replaceServerErrors(e,r){r?.byField?a.replacePartial("server",e,r.byField):a.replace("server",e)},clearServerErrors(){a.clear(["server"])},pushServerErrors(e){a.push("server",e)},syncServerErrors(){const r=e?.()??[];a.replace("server",r)}};export{E as errorManager,b as useErrors}; | ||
| import{getErrors as r,ValidationError as e,ConfigurationError as t,Auth0Error as a}from"@auth0/auth0-acul-js";import{useSyncExternalStore as n,useRef as o,useEffect as i,useMemo as c,useCallback as l}from"react";import{errorStore as s,ERROR_KINDS as u}from"../../state/error-store.js";function f(r,e){return e?r.filter(r=>r.field===e):r}const d=new WeakMap,h=new WeakMap,p=new WeakMap,v=(r,e)=>{const t="auth0"===r?d:"validation"===r?h:p,a=t.get(e);if(a)return a;const n=Object.freeze(e.map(e=>Object.freeze({...e,kind:r})));return t.set(e,n),n};function b(e={}){const{includeDevErrors:t=!1}=e,a=n(r=>s.subscribe(r),()=>s.snapshot()),d=o(!1);i(()=>{if(d.current)return;d.current=!0;const e=r?.()??[];s.replace("auth0",e)},[]);const h=c(()=>v("auth0",a.auth0),[a.auth0]),p=c(()=>v("validation",a.validation),[a.validation]),b=c(()=>v("configuration",a.configuration),[a.configuration]),E=c(()=>Object.freeze([...t?b:[],...p,...h]),[t,b,p,h]),g=c(()=>{const r=Object.assign([...E],{byKind(r,e){let t;return t="validation"===r?p:"configuration"===r?b:h,e?.field?Object.freeze(f(t,e.field)):t},byField:(e,t)=>t?.kind?r.byKind(t.kind,{field:e}):Object.freeze(f(E,e))});return Object.freeze(r)},[E,p,b,h]),y=E.length>0,m=l(r=>{s.remove(u,r)},[]),k=l(()=>{s.clear(u)},[]);return c(()=>({errors:g,hasError:y,dismiss:m,dismissAll:k}),[g,y,m,k])}const E={withError:function(r){const n=r=>{const n=function(r){return r instanceof e?"validation":r instanceof t?"configuration":r instanceof a?"auth0":null}(r),o=function(r){return{code:r?.code??(r instanceof Error?r.name:void 0)??"unknown_error",message:r?.message??"Unknown error",field:r?.field}}(r);switch(n){case"validation":E.replaceValidationErrors([o]);break;case"configuration":E.replaceDeveloperErrors([o]);break;case"auth0":E.replaceServerErrors([o]);break;default:throw console.error("[auth0-acul-react] Unhandled error:",r),r}};if("function"==typeof r)try{const e=r();return"object"==typeof(o=e)&&null!==o&&"then"in o&&"function"==typeof o.then?e.catch(r=>{throw n(r),r}):e}catch(r){throw n(r),r}var o;return r.catch(r=>{throw n(r),r})},replaceValidationErrors(r,e){e?.byField?s.replacePartial("validation",r,e.byField):s.replace("validation",r)},clearValidationErrors(){s.clear(["validation"])},pushValidationErrors(r){s.push("validation",r)},replaceDeveloperErrors(r,e){e?.byField?s.replacePartial("configuration",r,e.byField):s.replace("configuration",r)},clearDeveloperErrors(){s.clear(["configuration"])},pushDeveloperErrors(r){s.push("configuration",r)},replaceServerErrors(r,e){e?.byField?s.replacePartial("auth0",r,e.byField):s.replace("auth0",r)},clearServerErrors(){s.clear(["auth0"])},pushServerErrors(r){s.push("auth0",r)},syncServerErrors(){const e=r?.()??[];s.replace("auth0",e)}};export{E as errorManager,b as useErrors}; | ||
| //# sourceMappingURL=errors.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"errors.js","sources":["../../../src/hooks/common/errors.ts"],"sourcesContent":["import {\n SDKUsageError,\n UserInputError,\n Auth0ServerError,\n getErrors as getServerErrors,\n type Error as Auth0Error,\n} from '@auth0/auth0-acul-js';\nimport { useEffect, useMemo, useRef, useSyncExternalStore, useCallback } from 'react';\n\nimport { errorStore, ERROR_KINDS, type ErrorItem, type ErrorKind } from '../../state/error-store';\n\nexport interface ErrorsResult extends ReadonlyArray<ErrorItem> {\n byKind(kind: ErrorKind, opts?: { field?: string }): ReadonlyArray<ErrorItem>;\n byField(field: string, opts?: { kind?: ErrorKind }): ReadonlyArray<ErrorItem>;\n}\n\nexport interface UseErrorOptions {\n includeDevErrors?: boolean;\n}\n\nexport interface UseErrorsResult {\n errors: ErrorsResult;\n hasError: boolean;\n dismiss: (id: string) => void;\n dismissAll: () => void;\n}\n\nfunction classifyKind(e: unknown): ErrorKind | null {\n if (e instanceof UserInputError) {\n return 'client';\n }\n if (e instanceof SDKUsageError) {\n return 'developer';\n }\n if (e instanceof Auth0ServerError) {\n return 'server';\n }\n return null;\n}\n\nfunction toErrorObject(e: unknown): Omit<ErrorItem, 'id'> {\n return {\n code: (e as Auth0Error)?.code ?? (e instanceof Error ? e.name : undefined) ?? 'unknown_error',\n message: (e as Auth0Error)?.message ?? 'Unknown error',\n field: (e as Auth0Error)?.field,\n };\n}\n\nfunction filterByField<T extends { field?: string }>(\n list: ReadonlyArray<T>,\n field?: string\n): ReadonlyArray<T> {\n if (!field) {\n return list;\n }\n return list.filter((e) => e.field === field);\n}\n\n// caches for tagging\nconst cacheServer = new WeakMap<ReadonlyArray<ErrorItem>, ReadonlyArray<ErrorItem>>();\nconst cacheClient = new WeakMap<ReadonlyArray<ErrorItem>, ReadonlyArray<ErrorItem>>();\nconst cacheDev = new WeakMap<ReadonlyArray<ErrorItem>, ReadonlyArray<ErrorItem>>();\n\nconst tag = (kind: ErrorKind, arr: ReadonlyArray<ErrorItem>): ReadonlyArray<ErrorItem> => {\n const cache = kind === 'server' ? cacheServer : kind === 'client' ? cacheClient : cacheDev;\n const hit = cache.get(arr);\n if (hit) {\n return hit;\n }\n const out = Object.freeze(arr.map((e) => Object.freeze({ ...e, kind })));\n cache.set(arr, out);\n return out;\n};\n\n/**\n * React hook for reading and managing errors in ACUL (Advanced Customization of Universal Login).\n * With all validation and server-side errors. It groups errors into three kinds:\n * - `server` β errors returned by Auth0 or your own backend.\n * - `client` β errors from client-side validation (e.g., invalid form input).\n * - `developer` β errors caused by incorrect integration or SDK misuse.\n *\n * @supportedScreens\n * - The `useErrors` hook is available on every ACUL screen.\n *\n * @param options.includeDevErrors - When `true`, developer errors are included in\n * the returned list. Defaults to `false`.\n *\n * @returns An object of type {@link UseErrorsResult}, containing:\n * - `errors` β the full error list of type {@link ErrorsResult}, with helpers:\n * - `errors.byKind(kind, filter?)` β filter by error kind and optionally by field.\n * - `errors.byField(field, filter?)` β filter by field and optionally by kind.\n * - `hasError` β `true` if any error is currently present.\n * - `dismiss(id)` β remove a specific error by its ID.\n * - `dismissAll()` β clear all tracked errors.\n *\n * Typical usage is inside a form or screen component where you need to\n * reactively display errors and provide ways to dismiss them:\n *\n * @example\n * ```tsx\n * import { useErrors } from \"@auth0/auth0-acul-react\";\n *\n * export function SignupForm() {\n * const { errors, hasError, dismiss, dismissAll } = useErrors();\n *\n * return (\n * <div>\n * {hasError && (\n * <div className=\"mb-4\">\n * {errors.byKind(\"server\").map(err => (\n * <div key={err.id} className=\"text-red-600\">\n * {err.message}\n * <button onClick={() => dismiss(err.id)}>Dismiss</button>\n * </div>\n * ))}\n * </div>\n * )}\n *\n * <button onClick={dismissAll}>Clear All Errors</button>\n * </div>\n * );\n * }\n * ```\n *\n * In addition to rendering messages, you can filter by field or kind:\n * ```ts\n * console.log(errors.byKind('client')); // all client errors\n * console.log(errors.byKind('client', { field: 'username' })); // client errors for field 'username'\n * console.log(errors.byField('username')); // all errors for field 'username'\n * console.log(errors.byField('username', { kind: 'server' })); // server errors for field 'username'\n * ```\n */\n\nexport function useErrors(options: UseErrorOptions = {}): UseErrorsResult {\n const { includeDevErrors = false } = options;\n\n const snap = useSyncExternalStore(\n (cb) => errorStore.subscribe(cb),\n () => errorStore.snapshot()\n );\n\n const didInit = useRef(false);\n useEffect(() => {\n if (didInit.current) {\n return;\n }\n didInit.current = true;\n\n // Get server errors directly from TS SDK on first render.\n const server = (getServerErrors?.() ?? []) as Array<Omit<ErrorItem, 'id'>>;\n errorStore.replace('server', server);\n }, []);\n\n const serverTagged = useMemo(() => tag('server', snap.server), [snap.server]);\n const clientTagged = useMemo(() => tag('client', snap.client), [snap.client]);\n const devTagged = useMemo(() => tag('developer', snap.developer), [snap.developer]);\n\n const all = useMemo<ReadonlyArray<ErrorItem>>(\n () => Object.freeze([...(includeDevErrors ? devTagged : []), ...clientTagged, ...serverTagged]),\n [includeDevErrors, devTagged, clientTagged, serverTagged]\n );\n\n const errors: ErrorsResult = useMemo(() => {\n const arr = Object.assign([...all], {\n byKind(kind: ErrorKind, opts?: { field?: string }): ReadonlyArray<ErrorItem> {\n const base =\n kind === 'client' ? clientTagged : kind === 'developer' ? devTagged : serverTagged;\n return opts?.field ? Object.freeze(filterByField(base, opts.field)) : base;\n },\n byField(field: string, opts?: { kind?: ErrorKind }): ReadonlyArray<ErrorItem> {\n if (opts?.kind) {\n return arr.byKind(opts.kind, { field });\n }\n return Object.freeze(filterByField(all, field));\n },\n });\n return Object.freeze(arr);\n }, [all, clientTagged, devTagged, serverTagged]);\n\n const hasError = all.length > 0;\n\n const dismiss = useCallback((id: string) => {\n errorStore.remove(ERROR_KINDS, id);\n }, []);\n\n const dismissAll = useCallback(() => {\n errorStore.clear(ERROR_KINDS);\n }, []);\n\n return useMemo(\n () => ({ errors, hasError, dismiss, dismissAll }),\n [errors, hasError, dismiss, dismissAll]\n );\n}\n\n// ---------------- INTERNAL (SDK-only) ----------------\nconst isPromise = (v: unknown): v is Promise<unknown> =>\n typeof v === 'object' &&\n v !== null &&\n 'then' in v &&\n typeof (v as { then: unknown }).then === 'function';\n\nfunction withError<T>(actionOrPromise: (() => T | Promise<T>) | Promise<T>): T | Promise<T> {\n const handle = (e: unknown) => {\n const kind = classifyKind(e);\n const normalized = toErrorObject(e);\n switch (kind) {\n case 'client':\n errorManager.replaceClientErrors([normalized]);\n break;\n case 'developer':\n errorManager.replaceDeveloperErrors([normalized]);\n break;\n case 'server':\n errorManager.replaceServerErrors([normalized]);\n break;\n default: {\n console.error('[auth0-acul-react] Unhandled error:', e);\n throw e;\n }\n }\n };\n\n if (typeof actionOrPromise === 'function') {\n try {\n const result = (actionOrPromise as () => T | Promise<T>)();\n return isPromise(result)\n ? result.catch((e) => {\n handle(e);\n throw e;\n })\n : result;\n } catch (e) {\n handle(e);\n throw e;\n }\n }\n\n return actionOrPromise.catch((e) => {\n handle(e);\n throw e;\n });\n}\n\n/**\n * @hidden\n * Internal error manager for use by SDK methods.\n * Use the `useErrors` hook in React components instead.\n */\nexport const errorManager = {\n withError,\n\n replaceClientErrors(list: Array<Omit<ErrorItem, 'id'>>, opts?: { byField?: string }) {\n if (opts?.byField) {\n errorStore.replacePartial('client', list, opts.byField);\n } else {\n errorStore.replace('client', list);\n }\n },\n clearClientErrors() {\n errorStore.clear(['client']);\n },\n pushClientErrors(list: Omit<ErrorItem, 'id'> | Array<Omit<ErrorItem, 'id'>>) {\n errorStore.push('client', list);\n },\n\n replaceDeveloperErrors(list: Array<Omit<ErrorItem, 'id'>>, opts?: { byField?: string }) {\n if (opts?.byField) {\n errorStore.replacePartial('developer', list, opts.byField);\n } else {\n errorStore.replace('developer', list);\n }\n },\n clearDeveloperErrors() {\n errorStore.clear(['developer']);\n },\n pushDeveloperErrors(list: Omit<ErrorItem, 'id'> | Array<Omit<ErrorItem, 'id'>>) {\n errorStore.push('developer', list);\n },\n\n replaceServerErrors(list: Array<Omit<ErrorItem, 'id'>>, opts?: { byField?: string }) {\n if (opts?.byField) {\n errorStore.replacePartial('server', list, opts.byField);\n } else {\n errorStore.replace('server', list);\n }\n },\n clearServerErrors() {\n errorStore.clear(['server']);\n },\n pushServerErrors(list: Omit<ErrorItem, 'id'> | Array<Omit<ErrorItem, 'id'>>) {\n errorStore.push('server', list);\n },\n\n syncServerErrors() {\n const server = (getServerErrors?.() ?? []) as Array<Omit<ErrorItem, 'id'>>;\n errorStore.replace('server', server);\n },\n};\n\nexport { ErrorItem, ErrorKind };\n"],"names":["filterByField","list","field","filter","e","cacheServer","WeakMap","cacheClient","cacheDev","tag","kind","arr","cache","hit","get","out","Object","freeze","map","set","useErrors","options","includeDevErrors","snap","useSyncExternalStore","cb","errorStore","subscribe","snapshot","didInit","useRef","useEffect","current","server","getServerErrors","replace","serverTagged","useMemo","clientTagged","client","devTagged","developer","all","errors","assign","byKind","opts","base","byField","hasError","length","dismiss","useCallback","id","remove","ERROR_KINDS","dismissAll","clear","errorManager","withError","actionOrPromise","handle","UserInputError","SDKUsageError","Auth0ServerError","classifyKind","normalized","code","Error","name","undefined","message","toErrorObject","replaceClientErrors","replaceDeveloperErrors","replaceServerErrors","console","error","result","v","then","catch","replacePartial","clearClientErrors","pushClientErrors","push","clearDeveloperErrors","pushDeveloperErrors","clearServerErrors","pushServerErrors","syncServerErrors"],"mappings":"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"} | ||
| {"version":3,"file":"errors.js","sources":["../../../src/hooks/common/errors.ts"],"sourcesContent":["import {\n ConfigurationError,\n ValidationError,\n Auth0Error as Auth0ServerError,\n getErrors as getServerErrors,\n type Error as Auth0Error,\n} from '@auth0/auth0-acul-js';\nimport { useEffect, useMemo, useRef, useSyncExternalStore, useCallback } from 'react';\n\nimport { errorStore, ERROR_KINDS, type ErrorItem, type ErrorKind } from '../../state/error-store';\n\nexport interface ErrorsResult extends ReadonlyArray<ErrorItem> {\n byKind(kind: ErrorKind, opts?: { field?: string }): ReadonlyArray<ErrorItem>;\n byField(field: string, opts?: { kind?: ErrorKind }): ReadonlyArray<ErrorItem>;\n}\n\nexport interface UseErrorOptions {\n includeDevErrors?: boolean;\n}\n\nexport interface UseErrorsResult {\n errors: ErrorsResult;\n hasError: boolean;\n dismiss: (id: string) => void;\n dismissAll: () => void;\n}\n\nfunction classifyKind(e: unknown): ErrorKind | null {\n if (e instanceof ValidationError) {\n return 'validation';\n }\n if (e instanceof ConfigurationError) {\n return 'configuration';\n }\n if (e instanceof Auth0ServerError) {\n return 'auth0';\n }\n return null;\n}\n\nfunction toErrorObject(e: unknown): Omit<ErrorItem, 'id'> {\n return {\n code: (e as Auth0Error)?.code ?? (e instanceof Error ? e.name : undefined) ?? 'unknown_error',\n message: (e as Auth0Error)?.message ?? 'Unknown error',\n field: (e as Auth0Error)?.field,\n };\n}\n\nfunction filterByField<T extends { field?: string }>(\n list: ReadonlyArray<T>,\n field?: string\n): ReadonlyArray<T> {\n if (!field) {\n return list;\n }\n return list.filter((e) => e.field === field);\n}\n\n// caches for tagging\nconst cacheServer = new WeakMap<ReadonlyArray<ErrorItem>, ReadonlyArray<ErrorItem>>();\nconst cacheValidation = new WeakMap<ReadonlyArray<ErrorItem>, ReadonlyArray<ErrorItem>>();\nconst cacheDev = new WeakMap<ReadonlyArray<ErrorItem>, ReadonlyArray<ErrorItem>>();\n\nconst tag = (kind: ErrorKind, arr: ReadonlyArray<ErrorItem>): ReadonlyArray<ErrorItem> => {\n const cache = kind === 'auth0' ? cacheServer : kind === 'validation' ? cacheValidation : cacheDev;\n const hit = cache.get(arr);\n if (hit) {\n return hit;\n }\n const out = Object.freeze(arr.map((e) => Object.freeze({ ...e, kind })));\n cache.set(arr, out);\n return out;\n};\n\n/**\n * React hook for reading and managing errors in ACUL (Advanced Customization of Universal Login).\n * With all validation and server-side errors. It groups errors into three kinds:\n * - `auth0` β errors returned by Auth0 or your own backend.\n * - `validation` β errors from client-side validation (e.g., invalid form input).\n * - `configuration` β errors caused by incorrect integration or SDK misuse.\n *\n * @supportedScreens\n * - The `useErrors` hook is available on every ACUL screen.\n *\n * @param options.includeDevErrors - When `true`, configuration errors are included in\n * the returned list. Defaults to `false`.\n *\n * @returns An object of type {@link UseErrorsResult}, containing:\n * - `errors` β the full error list of type {@link ErrorsResult}, with helpers:\n * - `errors.byKind(kind, filter?)` β filter by error kind and optionally by field.\n * - `errors.byField(field, filter?)` β filter by field and optionally by kind.\n * - `hasError` β `true` if any error is currently present.\n * - `dismiss(id)` β remove a specific error by its ID.\n * - `dismissAll()` β clear all tracked errors.\n *\n * Typical usage is inside a form or screen component where you need to\n * reactively display errors and provide ways to dismiss them:\n *\n * @example\n * ```tsx\n * import { useErrors } from \"@auth0/auth0-acul-react\";\n *\n * export function SignupForm() {\n * const { errors, hasError, dismiss, dismissAll } = useErrors();\n *\n * return (\n * <div>\n * {hasError && (\n * <div className=\"mb-4\">\n * {errors.byKind(\"auth0\").map(err => (\n * <div key={err.id} className=\"text-red-600\">\n * {err.message}\n * <button onClick={() => dismiss(err.id)}>Dismiss</button>\n * </div>\n * ))}\n * </div>\n * )}\n *\n * <button onClick={dismissAll}>Clear All Errors</button>\n * </div>\n * );\n * }\n * ```\n *\n * In addition to rendering messages, you can filter by field or kind:\n * ```ts\n * console.log(errors.byKind('validation')); // all validation errors\n * console.log(errors.byKind('validation', { field: 'username' })); // validation errors for field 'username'\n * console.log(errors.byField('username')); // all errors for field 'username'\n * console.log(errors.byField('username', { kind: 'auth0' })); // auth0 errors for field 'username'\n * ```\n */\n\nexport function useErrors(options: UseErrorOptions = {}): UseErrorsResult {\n const { includeDevErrors = false } = options;\n\n const snap = useSyncExternalStore(\n (cb) => errorStore.subscribe(cb),\n () => errorStore.snapshot()\n );\n\n const didInit = useRef(false);\n useEffect(() => {\n if (didInit.current) {\n return;\n }\n didInit.current = true;\n\n // Get server errors directly from TS SDK on first render.\n const server = (getServerErrors?.() ?? []) as Array<Omit<ErrorItem, 'id'>>;\n errorStore.replace('auth0', server);\n }, []);\n\n const serverTagged = useMemo(() => tag('auth0', snap.auth0), [snap.auth0]);\n const clientTagged = useMemo(() => tag('validation', snap.validation), [snap.validation]);\n const devTagged = useMemo(() => tag('configuration', snap.configuration), [snap.configuration]);\n\n const all = useMemo<ReadonlyArray<ErrorItem>>(\n () => Object.freeze([...(includeDevErrors ? devTagged : []), ...clientTagged, ...serverTagged]),\n [includeDevErrors, devTagged, clientTagged, serverTagged]\n );\n\n const errors: ErrorsResult = useMemo(() => {\n const arr = Object.assign([...all], {\n byKind(kind: ErrorKind, opts?: { field?: string }): ReadonlyArray<ErrorItem> {\n let base: ReadonlyArray<ErrorItem>;\n if (kind === 'validation') {\n base = clientTagged;\n } else if (kind === 'configuration') {\n base = devTagged;\n } else {\n base = serverTagged;\n }\n if (opts?.field) {\n return Object.freeze(filterByField(base, opts.field));\n }\n return base;\n },\n byField(field: string, opts?: { kind?: ErrorKind }): ReadonlyArray<ErrorItem> {\n if (opts?.kind) {\n return arr.byKind(opts.kind, { field });\n }\n return Object.freeze(filterByField(all, field));\n },\n });\n return Object.freeze(arr);\n }, [all, clientTagged, devTagged, serverTagged]);\n\n const hasError = all.length > 0;\n\n const dismiss = useCallback((id: string) => {\n errorStore.remove(ERROR_KINDS, id);\n }, []);\n\n const dismissAll = useCallback(() => {\n errorStore.clear(ERROR_KINDS);\n }, []);\n\n return useMemo(\n () => ({ errors, hasError, dismiss, dismissAll }),\n [errors, hasError, dismiss, dismissAll]\n );\n}\n\n// ---------------- INTERNAL (SDK-only) ----------------\nconst isPromise = (v: unknown): v is Promise<unknown> =>\n typeof v === 'object' &&\n v !== null &&\n 'then' in v &&\n typeof (v as { then: unknown }).then === 'function';\n\nfunction withError<T>(actionOrPromise: (() => T | Promise<T>) | Promise<T>): T | Promise<T> {\n const handle = (e: unknown) => {\n const kind = classifyKind(e);\n const normalized = toErrorObject(e);\n switch (kind) {\n case 'validation':\n errorManager.replaceValidationErrors([normalized]);\n break;\n case 'configuration':\n errorManager.replaceDeveloperErrors([normalized]);\n break;\n case 'auth0':\n errorManager.replaceServerErrors([normalized]);\n break;\n default: {\n console.error('[auth0-acul-react] Unhandled error:', e);\n throw e;\n }\n }\n };\n\n if (typeof actionOrPromise === 'function') {\n try {\n const result = (actionOrPromise as () => T | Promise<T>)();\n return isPromise(result)\n ? result.catch((e) => {\n handle(e);\n throw e;\n })\n : result;\n } catch (e) {\n handle(e);\n throw e;\n }\n }\n\n return actionOrPromise.catch((e) => {\n handle(e);\n throw e;\n });\n}\n\n/**\n * @hidden\n * Internal error manager for use by SDK methods.\n * Use the `useErrors` hook in React components instead.\n */\nexport const errorManager = {\n withError,\n\n replaceValidationErrors(list: Array<Omit<ErrorItem, 'id'>>, opts?: { byField?: string }) {\n if (opts?.byField) {\n errorStore.replacePartial('validation', list, opts.byField);\n } else {\n errorStore.replace('validation', list);\n }\n },\n clearValidationErrors() {\n errorStore.clear(['validation']);\n },\n pushValidationErrors(list: Omit<ErrorItem, 'id'> | Array<Omit<ErrorItem, 'id'>>) {\n errorStore.push('validation', list);\n },\n\n replaceDeveloperErrors(list: Array<Omit<ErrorItem, 'id'>>, opts?: { byField?: string }) {\n if (opts?.byField) {\n errorStore.replacePartial('configuration', list, opts.byField);\n } else {\n errorStore.replace('configuration', list);\n }\n },\n clearDeveloperErrors() {\n errorStore.clear(['configuration']);\n },\n pushDeveloperErrors(list: Omit<ErrorItem, 'id'> | Array<Omit<ErrorItem, 'id'>>) {\n errorStore.push('configuration', list);\n },\n\n replaceServerErrors(list: Array<Omit<ErrorItem, 'id'>>, opts?: { byField?: string }) {\n if (opts?.byField) {\n errorStore.replacePartial('auth0', list, opts.byField);\n } else {\n errorStore.replace('auth0', list);\n }\n },\n clearServerErrors() {\n errorStore.clear(['auth0']);\n },\n pushServerErrors(list: Omit<ErrorItem, 'id'> | Array<Omit<ErrorItem, 'id'>>) {\n errorStore.push('auth0', list);\n },\n\n syncServerErrors() {\n const server = (getServerErrors?.() ?? []) as Array<Omit<ErrorItem, 'id'>>;\n errorStore.replace('auth0', server);\n },\n};\n\nexport { ErrorItem, ErrorKind };\n"],"names":["filterByField","list","field","filter","e","cacheServer","WeakMap","cacheValidation","cacheDev","tag","kind","arr","cache","hit","get","out","Object","freeze","map","set","useErrors","options","includeDevErrors","snap","useSyncExternalStore","cb","errorStore","subscribe","snapshot","didInit","useRef","useEffect","current","server","getServerErrors","replace","serverTagged","useMemo","auth0","clientTagged","validation","devTagged","configuration","all","errors","assign","byKind","opts","base","byField","hasError","length","dismiss","useCallback","id","remove","ERROR_KINDS","dismissAll","clear","errorManager","withError","actionOrPromise","handle","ValidationError","ConfigurationError","Auth0ServerError","classifyKind","normalized","code","Error","name","undefined","message","toErrorObject","replaceValidationErrors","replaceDeveloperErrors","replaceServerErrors","console","error","result","v","then","catch","replacePartial","clearValidationErrors","pushValidationErrors","push","clearDeveloperErrors","pushDeveloperErrors","clearServerErrors","pushServerErrors","syncServerErrors"],"mappings":"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"} |
@@ -11,1 +11,2 @@ export { useAuth0Themes } from './common/auth0-themes'; | ||
| export { useUsernameValidation, type UsernameValidationResult, type UsernameValidationError, } from './utility/validate-username'; | ||
| export { usePasskeyAutofill, type UsePasskeyAutofillResult } from './utility/passkey-autofill'; |
@@ -55,2 +55,3 @@ import type { MfaPollingOptions, Error as ULError } from '@auth0/auth0-acul-js'; | ||
| * - `reset-password-mfa-push-challenge-push` | ||
| * - `mfa-push-enrollment-qr` | ||
| * | ||
@@ -57,0 +58,0 @@ * @returns object {@link MfaPollingResult} containing: |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"polling-manager.js","sources":["../../../src/hooks/utility/polling-manager.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { getScreen } from '../../state/instance-store';\nimport { errorManager } from '../common/errors';\n\nimport type {\n MfaPollingOptions,\n MfaPushPollingControl,\n Error as ULError,\n} from '@auth0/auth0-acul-js';\n\n/**\n * Result object returned by {@link useMfaPolling}.\n *\n * @public\n */\nexport interface MfaPollingResult {\n /**\n * Indicates whether the MFA push polling process is currently active.\n *\n * - `true` β Polling is running and awaiting completion.\n * - `false` β Polling has stopped, either due to completion,\n * manual cancellation, or component unmount.\n */\n isRunning: boolean;\n\n /**\n * Starts or resumes the polling process.\n *\n * - If polling is already active, this call has no effect.\n * - If previously stopped, calling this restarts the polling loop.\n */\n startPolling: () => void;\n\n /**\n * Stops the polling process immediately.\n *\n * - Cancels any scheduled timers or in-flight requests.\n * - Safe to call multiple times; subsequent calls have no effect.\n */\n stopPolling: () => void;\n}\n\n/**\n * React hook to manage MFA push polling (e.g., waiting for a push notification approval)\n * on an Auth0 Advanced Customization of Universal Login (ACUL) screen.\n *\n * This hook sets up and controls a long-running polling loop that repeatedly checks\n * the MFA push challenge endpoint until one of the following occurs:\n *\n * - The challenge is **approved or denied** by the user, triggering `options.onCompleted`.\n * - An **error** occurs (network error, non-200/429 response), triggering `options.onError`.\n * - The **component unmounts** or `stopPolling()` is called, which cancels polling.\n *\n * ### Key Features\n * - `isRunning` is **reactive** β it updates automatically if the polling loop\n * stops internally or is canceled.\n * - Uses a **stable single polling instance** (`useRef`) to prevent\n * duplicate network calls and unintended restarts during React re-renders.\n * - **Automatic cleanup** on unmount: no orphan timers or leaked XHR requests.\n *\n * @param options - {@link MfaPollingOptions} specifying the polling interval,\n * success callback (`onCompleted`), and optional error handler (`onError`).\n *\n *@supportedScreens\n * - `mfa-push-challenge-push`\n * - `reset-password-mfa-push-challenge-push`\n *\n * @returns object {@link MfaPollingResult} containing:\n * - `isRunning` β `true` while polling is active.\n * - `startPolling()` β starts or resumes polling.\n * - `stopPolling()` β stops polling immediately.\n *\n * @example\n * ```tsx\n * import { useMfaPolling } from '@auth0/auth0-acul-react/mfa-push-challenge-push';\n *\n * export function MfaPushStatus() {\n * const { isRunning, startPolling, stopPolling } = useMfaPolling({\n * intervalMs: 5000,\n * onCompleted: () => console.log('Push approved!/denied'),\n * onError: (error) => console.error('Polling error:', error)\n * });\n *\n * return (\n * <div>\n * <button onClick={startPolling} disabled={isRunning}>\n * {isRunning ? 'Waiting for approvalβ¦' : 'Start MFA Polling'}\n * </button>\n * {isRunning && <button onClick={stopPolling}>Cancel</button>}\n * </div>\n * );\n * }\n * ```\n *\n * @remarks\n * - The `onError` callback receives an {@link ULError} object\n * with `status` and `responseText` describing the server response.\n * - Internal rate-limit responses (`429`) are automatically handled:\n * polling waits for the reset window before retrying.\n * - Calling `startPolling()` repeatedly while running is safe and idempotent.\n *\n * @public\n */\nexport function useMfaPolling(options?: MfaPollingOptions): MfaPollingResult {\n const [isRunning, setIsRunning] = useState(false);\n\n // Wrap callbacks safely to immediately update `isRunning` on completion/error.\n const wrappedOptions: MfaPollingOptions = useMemo(() => {\n const safe = options ?? {};\n return {\n ...safe,\n onCompleted: () => {\n setIsRunning(false);\n safe.onCompleted?.();\n },\n onError: (error: ULError) => {\n setIsRunning(false);\n errorManager.pushServerErrors([error]);\n safe.onError?.(error);\n },\n };\n }, [options]);\n\n // Stable screen instance\n const screen = useMemo(\n () => getScreen<{ pollingManager: (o: MfaPollingOptions) => MfaPushPollingControl }>(),\n []\n );\n\n // Single polling control instance per component\n const pollingControlRef = useRef<MfaPushPollingControl | null>(null);\n if (pollingControlRef.current === null) {\n pollingControlRef.current = screen.pollingManager(wrappedOptions);\n }\n const pollingControl = pollingControlRef.current;\n\n const startPolling = useCallback(() => {\n pollingControl.startPolling();\n setIsRunning(true);\n }, [pollingControl]);\n\n const stopPolling = useCallback(() => {\n pollingControl.stopPolling();\n setIsRunning(false);\n }, [pollingControl]);\n\n // One effect handles cleanup and state sync\n useEffect(() => {\n let mounted = true;\n\n const tick = () => {\n if (!mounted) {\n return;\n }\n const running = pollingControl.isRunning();\n setIsRunning(running);\n if (running) {\n requestAnimationFrame(tick);\n }\n };\n tick();\n\n return () => {\n mounted = false;\n pollingControl.stopPolling();\n };\n }, [pollingControl]);\n\n return { isRunning, startPolling, stopPolling };\n}\n\nexport type { MfaPollingOptions, ULError };\n"],"names":["useMfaPolling","options","isRunning","setIsRunning","useState","wrappedOptions","useMemo","safe","onCompleted","onError","error","errorManager","pushServerErrors","screen","getScreen","pollingControlRef","useRef","current","pollingManager","pollingControl","startPolling","useCallback","stopPolling","useEffect","mounted","tick","running","requestAnimationFrame"],"mappings":"uMAwGM,SAAUA,EAAcC,GAC5B,MAAOC,EAAWC,GAAgBC,GAAS,GAGrCC,EAAoCC,EAAQ,KAChD,MAAMC,EAAON,GAAW,CAAA,EACxB,MAAO,IACFM,EACHC,YAAa,KACXL,GAAa,GACbI,EAAKC,iBAEPC,QAAUC,IACRP,GAAa,GACbQ,EAAaC,iBAAiB,CAACF,IAC/BH,EAAKE,UAAUC,MAGlB,CAACT,IAGEY,EAASP,EACb,IAAMQ,IACN,IAIIC,EAAoBC,EAAqC,MAC7B,OAA9BD,EAAkBE,UACpBF,EAAkBE,QAAUJ,EAAOK,eAAeb,IAEpD,MAAMc,EAAiBJ,EAAkBE,QAEnCG,EAAeC,EAAY,KAC/BF,EAAeC,eACfjB,GAAa,IACZ,CAACgB,IAEEG,EAAcD,EAAY,KAC9BF,EAAeG,cACfnB,GAAa,IACZ,CAACgB,IAwBJ,OArBAI,EAAU,KACR,IAAIC,GAAU,EAEd,MAAMC,EAAO,KACX,IAAKD,EACH,OAEF,MAAME,EAAUP,EAAejB,YAC/BC,EAAauB,GACTA,GACFC,sBAAsBF,IAK1B,OAFAA,IAEO,KACLD,GAAU,EACVL,EAAeG,gBAEhB,CAACH,IAEG,CAAEjB,YAAWkB,eAAcE,cACpC"} | ||
| {"version":3,"file":"polling-manager.js","sources":["../../../src/hooks/utility/polling-manager.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { getScreen } from '../../state/instance-store';\nimport { errorManager } from '../common/errors';\n\nimport type {\n MfaPollingOptions,\n MfaPushPollingControl,\n Error as ULError,\n} from '@auth0/auth0-acul-js';\n\n/**\n * Result object returned by {@link useMfaPolling}.\n *\n * @public\n */\nexport interface MfaPollingResult {\n /**\n * Indicates whether the MFA push polling process is currently active.\n *\n * - `true` β Polling is running and awaiting completion.\n * - `false` β Polling has stopped, either due to completion,\n * manual cancellation, or component unmount.\n */\n isRunning: boolean;\n\n /**\n * Starts or resumes the polling process.\n *\n * - If polling is already active, this call has no effect.\n * - If previously stopped, calling this restarts the polling loop.\n */\n startPolling: () => void;\n\n /**\n * Stops the polling process immediately.\n *\n * - Cancels any scheduled timers or in-flight requests.\n * - Safe to call multiple times; subsequent calls have no effect.\n */\n stopPolling: () => void;\n}\n\n/**\n * React hook to manage MFA push polling (e.g., waiting for a push notification approval)\n * on an Auth0 Advanced Customization of Universal Login (ACUL) screen.\n *\n * This hook sets up and controls a long-running polling loop that repeatedly checks\n * the MFA push challenge endpoint until one of the following occurs:\n *\n * - The challenge is **approved or denied** by the user, triggering `options.onCompleted`.\n * - An **error** occurs (network error, non-200/429 response), triggering `options.onError`.\n * - The **component unmounts** or `stopPolling()` is called, which cancels polling.\n *\n * ### Key Features\n * - `isRunning` is **reactive** β it updates automatically if the polling loop\n * stops internally or is canceled.\n * - Uses a **stable single polling instance** (`useRef`) to prevent\n * duplicate network calls and unintended restarts during React re-renders.\n * - **Automatic cleanup** on unmount: no orphan timers or leaked XHR requests.\n *\n * @param options - {@link MfaPollingOptions} specifying the polling interval,\n * success callback (`onCompleted`), and optional error handler (`onError`).\n *\n *@supportedScreens\n * - `mfa-push-challenge-push`\n * - `reset-password-mfa-push-challenge-push`\n * - `mfa-push-enrollment-qr`\n *\n * @returns object {@link MfaPollingResult} containing:\n * - `isRunning` β `true` while polling is active.\n * - `startPolling()` β starts or resumes polling.\n * - `stopPolling()` β stops polling immediately.\n *\n * @example\n * ```tsx\n * import { useMfaPolling } from '@auth0/auth0-acul-react/mfa-push-challenge-push';\n *\n * export function MfaPushStatus() {\n * const { isRunning, startPolling, stopPolling } = useMfaPolling({\n * intervalMs: 5000,\n * onCompleted: () => console.log('Push approved!/denied'),\n * onError: (error) => console.error('Polling error:', error)\n * });\n *\n * return (\n * <div>\n * <button onClick={startPolling} disabled={isRunning}>\n * {isRunning ? 'Waiting for approvalβ¦' : 'Start MFA Polling'}\n * </button>\n * {isRunning && <button onClick={stopPolling}>Cancel</button>}\n * </div>\n * );\n * }\n * ```\n *\n * @remarks\n * - The `onError` callback receives an {@link ULError} object\n * with `status` and `responseText` describing the server response.\n * - Internal rate-limit responses (`429`) are automatically handled:\n * polling waits for the reset window before retrying.\n * - Calling `startPolling()` repeatedly while running is safe and idempotent.\n *\n * @public\n */\nexport function useMfaPolling(options?: MfaPollingOptions): MfaPollingResult {\n const [isRunning, setIsRunning] = useState(false);\n\n // Wrap callbacks safely to immediately update `isRunning` on completion/error.\n const wrappedOptions: MfaPollingOptions = useMemo(() => {\n const safe = options ?? {};\n return {\n ...safe,\n onCompleted: () => {\n setIsRunning(false);\n safe.onCompleted?.();\n },\n onError: (error: ULError) => {\n setIsRunning(false);\n errorManager.pushServerErrors([error]);\n safe.onError?.(error);\n },\n };\n }, [options]);\n\n // Stable screen instance\n const screen = useMemo(\n () => getScreen<{ pollingManager: (o: MfaPollingOptions) => MfaPushPollingControl }>(),\n []\n );\n\n // Single polling control instance per component\n const pollingControlRef = useRef<MfaPushPollingControl | null>(null);\n if (pollingControlRef.current === null) {\n pollingControlRef.current = screen.pollingManager(wrappedOptions);\n }\n const pollingControl = pollingControlRef.current;\n\n const startPolling = useCallback(() => {\n pollingControl.startPolling();\n setIsRunning(true);\n }, [pollingControl]);\n\n const stopPolling = useCallback(() => {\n pollingControl.stopPolling();\n setIsRunning(false);\n }, [pollingControl]);\n\n // One effect handles cleanup and state sync\n useEffect(() => {\n let mounted = true;\n\n const tick = () => {\n if (!mounted) {\n return;\n }\n const running = pollingControl.isRunning();\n setIsRunning(running);\n if (running) {\n requestAnimationFrame(tick);\n }\n };\n tick();\n\n return () => {\n mounted = false;\n pollingControl.stopPolling();\n };\n }, [pollingControl]);\n\n return { isRunning, startPolling, stopPolling };\n}\n\nexport type { MfaPollingOptions, ULError };\n"],"names":["useMfaPolling","options","isRunning","setIsRunning","useState","wrappedOptions","useMemo","safe","onCompleted","onError","error","errorManager","pushServerErrors","screen","getScreen","pollingControlRef","useRef","current","pollingManager","pollingControl","startPolling","useCallback","stopPolling","useEffect","mounted","tick","running","requestAnimationFrame"],"mappings":"uMAyGM,SAAUA,EAAcC,GAC5B,MAAOC,EAAWC,GAAgBC,GAAS,GAGrCC,EAAoCC,EAAQ,KAChD,MAAMC,EAAON,GAAW,CAAA,EACxB,MAAO,IACFM,EACHC,YAAa,KACXL,GAAa,GACbI,EAAKC,iBAEPC,QAAUC,IACRP,GAAa,GACbQ,EAAaC,iBAAiB,CAACF,IAC/BH,EAAKE,UAAUC,MAGlB,CAACT,IAGEY,EAASP,EACb,IAAMQ,IACN,IAIIC,EAAoBC,EAAqC,MAC7B,OAA9BD,EAAkBE,UACpBF,EAAkBE,QAAUJ,EAAOK,eAAeb,IAEpD,MAAMc,EAAiBJ,EAAkBE,QAEnCG,EAAeC,EAAY,KAC/BF,EAAeC,eACfjB,GAAa,IACZ,CAACgB,IAEEG,EAAcD,EAAY,KAC9BF,EAAeG,cACfnB,GAAa,IACZ,CAACgB,IAwBJ,OArBAI,EAAU,KACR,IAAIC,GAAU,EAEd,MAAMC,EAAO,KACX,IAAKD,EACH,OAEF,MAAME,EAAUP,EAAejB,YAC/BC,EAAauB,GACTA,GACFC,sBAAsBF,IAK1B,OAFAA,IAEO,KACLD,GAAU,EACVL,EAAeG,gBAEhB,CAACH,IAEG,CAAEjB,YAAWkB,eAAcE,cACpC"} |
@@ -1,2 +0,2 @@ | ||
| import{useMemo as r}from"react";import{getScreen as e}from"../../state/instance-store.js";import{errorManager as s}from"../common/errors.js";function o(o,t){return r(()=>{const r=e().validatePassword(o);return t?.includeInErrors&&s.replaceClientErrors(r.isValid?[]:[{code:"password-policy-error",field:"password",message:"The password does not meet the required criteria.",rules:r.results}],{byField:"password"}),r},[o,t?.includeInErrors])}export{o as usePasswordValidation}; | ||
| import{useMemo as r}from"react";import{getScreen as e}from"../../state/instance-store.js";import{errorManager as o}from"../common/errors.js";function s(s,t){return r(()=>{const r=e().validatePassword(s);return t?.includeInErrors&&o.replaceValidationErrors(r.isValid?[]:[{code:"password-policy-error",field:"password",message:"The password does not meet the required criteria.",rules:r.results}],{byField:"password"}),r},[s,t?.includeInErrors])}export{s as usePasswordValidation}; | ||
| //# sourceMappingURL=validate-password.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"validate-password.js","sources":["../../../src/hooks/utility/validate-password.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { getScreen } from '../../state/instance-store';\nimport { errorManager } from '../common/errors';\n\nimport type { PasswordValidationResult } from '@auth0/auth0-acul-js';\n\ninterface WithValidatePassword {\n validatePassword: (password: string) => PasswordValidationResult;\n}\n\n/**\n * This React hook validates a password against the current Auth0 password policy\n * and returns a structured result describing whether the password satisfies each rule.\n *\n * Optionally, it can send the validation results to the global error manager so that\n * form error components can update automatically.\n *\n * @supportedScreens\n * - `signup`\n * - `signup-password`\n * - `reset-password`\n *\n * @param password\n * - The password to validate.\n * @param options.includeInErrors\n * - If `true`, validation errors are stored in the global error manager under the `password` field. Defaults to `false`.\n *\n * @returns A {@link PasswordValidationResult} object containing:\n * - `isValid` β `true` if the password satisfies all configured rules.\n * - `results` β an array of per-rule results with `code`, `label`, `status`, and `isValid`.\n *\n * @example This example shows how to use the hook in a functional component on \"signup\" screen.\n * ```tsx\n * import { usePasswordValidation } from '@auth0/auth0-acul-react/signup';\n * const { isValid, results} = usePasswordValidation(password, { includeInErrors: true });\n *\n * if (!isValid) {\n * console.log(results);\n * }\n * ```\n */\nexport function usePasswordValidation(\n password: string,\n options?: { includeInErrors?: boolean }\n): PasswordValidationResult {\n return useMemo(() => {\n const instance = getScreen<WithValidatePassword>();\n const validation = instance.validatePassword(password);\n\n if (options?.includeInErrors) {\n errorManager.replaceClientErrors(\n validation.isValid\n ? []\n : [\n {\n code: 'password-policy-error',\n field: 'password',\n message: 'The password does not meet the required criteria.',\n rules: validation.results,\n },\n ],\n { byField: 'password' }\n );\n }\n\n return validation;\n }, [password, options?.includeInErrors]);\n}\n\nexport { PasswordValidationResult, PasswordComplexityRule } from '@auth0/auth0-acul-js';\n"],"names":["usePasswordValidation","password","options","useMemo","validation","getScreen","validatePassword","includeInErrors","errorManager","replaceClientErrors","isValid","code","field","message","rules","results","byField"],"mappings":"6IA0CM,SAAUA,EACdC,EACAC,GAEA,OAAOC,EAAQ,KACb,MACMC,EADWC,IACWC,iBAAiBL,GAkB7C,OAhBIC,GAASK,iBACXC,EAAaC,oBACXL,EAAWM,QACP,GACA,CACE,CACEC,KAAM,wBACNC,MAAO,WACPC,QAAS,oDACTC,MAAOV,EAAWW,UAG1B,CAAEC,QAAS,aAIRZ,GACN,CAACH,EAAUC,GAASK,iBACzB"} | ||
| {"version":3,"file":"validate-password.js","sources":["../../../src/hooks/utility/validate-password.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { getScreen } from '../../state/instance-store';\nimport { errorManager } from '../common/errors';\n\nimport type { PasswordValidationResult } from '@auth0/auth0-acul-js';\n\ninterface WithValidatePassword {\n validatePassword: (password: string) => PasswordValidationResult;\n}\n\n/**\n * This React hook validates a password against the current Auth0 password policy\n * and returns a structured result describing whether the password satisfies each rule.\n *\n * Optionally, it can send the validation results to the global error manager so that\n * form error components can update automatically.\n *\n * @supportedScreens\n * - `signup`\n * - `signup-password`\n * - `reset-password`\n *\n * @param password\n * - The password to validate.\n * @param options.includeInErrors\n * - If `true`, validation errors are stored in the global error manager under the `password` field. Defaults to `false`.\n *\n * @returns A {@link PasswordValidationResult} object containing:\n * - `isValid` β `true` if the password satisfies all configured rules.\n * - `results` β an array of per-rule results with `code`, `label`, `status`, and `isValid`.\n *\n * @example This example shows how to use the hook in a functional component on \"signup\" screen.\n * ```tsx\n * import { usePasswordValidation } from '@auth0/auth0-acul-react/signup';\n * const { isValid, results} = usePasswordValidation(password, { includeInErrors: true });\n *\n * if (!isValid) {\n * console.log(results);\n * }\n * ```\n */\nexport function usePasswordValidation(\n password: string,\n options?: { includeInErrors?: boolean }\n): PasswordValidationResult {\n return useMemo(() => {\n const instance = getScreen<WithValidatePassword>();\n const validation = instance.validatePassword(password);\n\n if (options?.includeInErrors) {\n errorManager.replaceValidationErrors(\n validation.isValid\n ? []\n : [\n {\n code: 'password-policy-error',\n field: 'password',\n message: 'The password does not meet the required criteria.',\n rules: validation.results,\n },\n ],\n { byField: 'password' }\n );\n }\n\n return validation;\n }, [password, options?.includeInErrors]);\n}\n\nexport { PasswordValidationResult, PasswordComplexityRule } from '@auth0/auth0-acul-js';\n"],"names":["usePasswordValidation","password","options","useMemo","validation","getScreen","validatePassword","includeInErrors","errorManager","replaceValidationErrors","isValid","code","field","message","rules","results","byField"],"mappings":"6IA0CM,SAAUA,EACdC,EACAC,GAEA,OAAOC,EAAQ,KACb,MACMC,EADWC,IACWC,iBAAiBL,GAkB7C,OAhBIC,GAASK,iBACXC,EAAaC,wBACXL,EAAWM,QACP,GACA,CACE,CACEC,KAAM,wBACNC,MAAO,WACPC,QAAS,oDACTC,MAAOV,EAAWW,UAG1B,CAAEC,QAAS,aAIRZ,GACN,CAACH,EAAUC,GAASK,iBACzB"} |
@@ -1,2 +0,2 @@ | ||
| import{useMemo as r}from"react";import{getScreen as e}from"../../state/instance-store.js";import{errorManager as o}from"../common/errors.js";function s(s,n){return r(()=>{const r=e().validateUsername(s);return n?.includeInErrors&&o.replaceClientErrors(r.errors,{byField:"username"}),{isValid:r.isValid,errors:r.errors}},[s,n?.includeInErrors])}export{s as useUsernameValidation}; | ||
| import{useMemo as r}from"react";import{getScreen as e}from"../../state/instance-store.js";import{errorManager as o}from"../common/errors.js";function s(s,i){return r(()=>{const r=e().validateUsername(s);return i?.includeInErrors&&o.replaceValidationErrors(r.errors,{byField:"username"}),{isValid:r.isValid,errors:r.errors}},[s,i?.includeInErrors])}export{s as useUsernameValidation}; | ||
| //# sourceMappingURL=validate-username.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"validate-username.js","sources":["../../../src/hooks/utility/validate-username.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { getScreen } from '../../state/instance-store';\nimport { errorManager } from '../common/errors';\n\nimport type { UsernameValidationResult } from '@auth0/auth0-acul-js';\n\ninterface WithValidateUsername {\n validateUsername: (username: string) => UsernameValidationResult;\n}\n\n/**\n * React hook for validating a username against the current Auth0 username policy.\n *\n * This hook checks the provided username against all configured validation rules\n * and returns a structured result describing whether it passes.\n * Optionally, it can send validation errors to the global error manager so that\n * UI components observing the `username` field can automatically display or react\n * to these errors.\n *\n * @supportedScreens\n * - `signup`\n * - `signup-id`\n *\n * @param username - The username string to validate.\n * @param options.includeInErrors - When `true`, validation errors are stored in the\n * global error manager under the `username` field. Defaults to `false`.\n *\n * @returns A {@link UsernameValidationResult} object with:\n * - `isValid` β `true` if the username satisfies all configured rules.\n * - `errors` β an array of per-rule validation errors with `code`, `message`, and `isValid`.\n *\n * @example\n * ```tsx\n * import { useUsernameValidation } from \"@auth0/auth0-acul-react/signup\";\n *\n * export function UsernameField() {\n * const { isValid, errors } = useUsernameValidation(username, { includeInErrors: true });\n *\n * return (\n * <div>\n * <input\n * value={username}\n * onChange={e => setUsername(e.target.value)}\n * aria-invalid={!isValid}\n * />\n *\n * {!isValid && (\n * <ul>\n * {errors.map(err => (\n * <li key={err.code}>{err.message}</li>\n * ))}\n * </ul>\n * )}\n * </div>\n * );\n * }\n * ```\n *\n * @remarks\n * - When `includeInErrors` is enabled, the hook automatically updates the errors to the error-store\n * which can be consumed by `useErrors` hook.\n * - The hook only recomputes when `username` or `options.includeInErrors` change.\n */\nexport function useUsernameValidation(\n username: string,\n options?: { includeInErrors?: boolean }\n): UsernameValidationResult {\n return useMemo(() => {\n const instance = getScreen<WithValidateUsername>();\n const result = instance.validateUsername(username);\n\n if (options?.includeInErrors) {\n errorManager.replaceClientErrors(result.errors, { byField: 'username' });\n }\n\n return { isValid: result.isValid, errors: result.errors };\n }, [username, options?.includeInErrors]);\n}\n\nexport type { UsernameValidationResult, UsernameValidationError } from '@auth0/auth0-acul-js';\n"],"names":["useUsernameValidation","username","options","useMemo","result","getScreen","validateUsername","includeInErrors","errorManager","replaceClientErrors","errors","byField","isValid"],"mappings":"6IAgEM,SAAUA,EACdC,EACAC,GAEA,OAAOC,EAAQ,KACb,MACMC,EADWC,IACOC,iBAAiBL,GAMzC,OAJIC,GAASK,iBACXC,EAAaC,oBAAoBL,EAAOM,OAAQ,CAAEC,QAAS,aAGtD,CAAEC,QAASR,EAAOQ,QAASF,OAAQN,EAAOM,SAChD,CAACT,EAAUC,GAASK,iBACzB"} | ||
| {"version":3,"file":"validate-username.js","sources":["../../../src/hooks/utility/validate-username.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { getScreen } from '../../state/instance-store';\nimport { errorManager } from '../common/errors';\n\nimport type { UsernameValidationResult } from '@auth0/auth0-acul-js';\n\ninterface WithValidateUsername {\n validateUsername: (username: string) => UsernameValidationResult;\n}\n\n/**\n * React hook for validating a username against the current Auth0 username policy.\n *\n * This hook checks the provided username against all configured validation rules\n * and returns a structured result describing whether it passes.\n * Optionally, it can send validation errors to the global error manager so that\n * UI components observing the `username` field can automatically display or react\n * to these errors.\n *\n * @supportedScreens\n * - `signup`\n * - `signup-id`\n *\n * @param username - The username string to validate.\n * @param options.includeInErrors - When `true`, validation errors are stored in the\n * global error manager under the `username` field. Defaults to `false`.\n *\n * @returns A {@link UsernameValidationResult} object with:\n * - `isValid` β `true` if the username satisfies all configured rules.\n * - `errors` β an array of per-rule validation errors with `code`, `message`, and `isValid`.\n *\n * @example\n * ```tsx\n * import { useUsernameValidation } from \"@auth0/auth0-acul-react/signup\";\n *\n * export function UsernameField() {\n * const { isValid, errors } = useUsernameValidation(username, { includeInErrors: true });\n *\n * return (\n * <div>\n * <input\n * value={username}\n * onChange={e => setUsername(e.target.value)}\n * aria-invalid={!isValid}\n * />\n *\n * {!isValid && (\n * <ul>\n * {errors.map(err => (\n * <li key={err.code}>{err.message}</li>\n * ))}\n * </ul>\n * )}\n * </div>\n * );\n * }\n * ```\n *\n * @remarks\n * - When `includeInErrors` is enabled, the hook automatically updates the errors to the error-store\n * which can be consumed by `useErrors` hook.\n * - The hook only recomputes when `username` or `options.includeInErrors` change.\n */\nexport function useUsernameValidation(\n username: string,\n options?: { includeInErrors?: boolean }\n): UsernameValidationResult {\n return useMemo(() => {\n const instance = getScreen<WithValidateUsername>();\n const result = instance.validateUsername(username);\n\n if (options?.includeInErrors) {\n errorManager.replaceValidationErrors(result.errors, { byField: 'username' });\n }\n\n return { isValid: result.isValid, errors: result.errors };\n }, [username, options?.includeInErrors]);\n}\n\nexport type { UsernameValidationResult, UsernameValidationError } from '@auth0/auth0-acul-js';\n"],"names":["useUsernameValidation","username","options","useMemo","result","getScreen","validateUsername","includeInErrors","errorManager","replaceValidationErrors","errors","byField","isValid"],"mappings":"6IAgEM,SAAUA,EACdC,EACAC,GAEA,OAAOC,EAAQ,KACb,MACMC,EADWC,IACOC,iBAAiBL,GAMzC,OAJIC,GAASK,iBACXC,EAAaC,wBAAwBL,EAAOM,OAAQ,CAAEC,QAAS,aAG1D,CAAEC,QAASR,EAAOQ,QAASF,OAAQN,EAAOM,SAChD,CAACT,EAAUC,GAASK,iBACzB"} |
@@ -8,3 +8,4 @@ import type { LoginIdMembers, LoginOptions, FederatedLoginOptions, CustomOptions } from '@auth0/auth0-acul-js/login-id'; | ||
| export { useLoginIdentifiers } from '../hooks/utility/login-identifiers'; | ||
| export { usePasskeyAutofill } from '../hooks/utility/passkey-autofill'; | ||
| export { useCurrentScreen, useErrors, useAuth0Themes, type UseErrorOptions, type UseErrorsResult, type ErrorsResult, type ErrorKind, } from '../hooks'; | ||
| export declare const useLoginId: () => LoginIdMembers; |
@@ -1,2 +0,2 @@ | ||
| import o from"@auth0/auth0-acul-js/login-id";import{useMemo as e}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as r}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";export{useLoginIdentifiers}from"../hooks/utility/login-identifiers.js";import{registerScreen as t}from"../state/instance-store.js";const n=t(o),{withError:i}=r,m=new s(n),{useUser:u,useTenant:a,useBranding:c,useClient:h,useOrganization:p,usePrompt:f,useScreen:d,useTransaction:g,useUntrustedData:j}=m,k=o=>i(n.login(o)),x=o=>i(n.federatedLogin(o)),l=o=>i(n.passkeyLogin(o)),C=o=>i(n.pickCountryCode(o)),y=()=>e(()=>n,[]);export{x as federatedLogin,k as login,l as passkeyLogin,C as pickCountryCode,c as useBranding,h as useClient,y as useLoginId,p as useOrganization,f as usePrompt,d as useScreen,a as useTenant,g as useTransaction,j as useUntrustedData,u as useUser}; | ||
| import o from"@auth0/auth0-acul-js/login-id";import{useMemo as e}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as r}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";export{useLoginIdentifiers}from"../hooks/utility/login-identifiers.js";import{registerScreen as t}from"../state/instance-store.js";export{usePasskeyAutofill}from"../hooks/utility/passkey-autofill.js";const n=t(o),{withError:i}=r,u=new s(n),{useUser:m,useTenant:a,useBranding:c,useClient:f,useOrganization:p,usePrompt:h,useScreen:k,useTransaction:l,useUntrustedData:d}=u,j=o=>i(n.login(o)),g=o=>i(n.federatedLogin(o)),x=o=>i(n.passkeyLogin(o)),y=o=>i(n.pickCountryCode(o)),C=()=>e(()=>n,[]);export{g as federatedLogin,j as login,x as passkeyLogin,y as pickCountryCode,c as useBranding,f as useClient,C as useLoginId,p as useOrganization,h as usePrompt,k as useScreen,a as useTenant,l as useTransaction,d as useUntrustedData,m as useUser}; | ||
| //# sourceMappingURL=login-id.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"login-id.js","sources":["../../src/screens/login-id.tsx"],"sourcesContent":["import LoginId from '@auth0/auth0-acul-js/login-id';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n LoginIdMembers,\n LoginOptions,\n FederatedLoginOptions,\n CustomOptions,\n} from '@auth0/auth0-acul-js/login-id';\n\n// Register the singleton instance of LoginId\nconst instance = registerScreen<LoginIdMembers>(LoginId)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<LoginIdMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const login = (payload: LoginOptions) => withError(instance.login(payload));\nexport const federatedLogin = (payload: FederatedLoginOptions) =>\n withError(instance.federatedLogin(payload));\nexport const passkeyLogin = (payload?: CustomOptions) => withError(instance.passkeyLogin(payload));\nexport const pickCountryCode = (payload?: CustomOptions) =>\n withError(instance.pickCountryCode(payload));\n\n// Utility Hooks\nexport { useLoginIdentifiers } from '../hooks/utility/login-identifiers';\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of LoginId\nexport const useLoginId = (): LoginIdMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","LoginId","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","login","payload","federatedLogin","passkeyLogin","pickCountryCode","useLoginId","useMemo"],"mappings":"+eAeA,MAAMA,EAAWC,EAA+BC,IAG1CC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAA6BN,IACpCO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAASC,GAA0Bd,EAAUH,EAASgB,MAAMC,IAC5DC,EAAkBD,GAC7Bd,EAAUH,EAASkB,eAAeD,IACvBE,EAAgBF,GAA4Bd,EAAUH,EAASmB,aAAaF,IAC5EG,EAAmBH,GAC9Bd,EAAUH,EAASoB,gBAAgBH,IAiBxBI,EAAa,IAAsBC,EAAQ,IAAMtB,EAAU"} | ||
| {"version":3,"file":"login-id.js","sources":["../../src/screens/login-id.tsx"],"sourcesContent":["import LoginId from '@auth0/auth0-acul-js/login-id';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n LoginIdMembers,\n LoginOptions,\n FederatedLoginOptions,\n CustomOptions,\n} from '@auth0/auth0-acul-js/login-id';\n\n// Register the singleton instance of LoginId\nconst instance = registerScreen<LoginIdMembers>(LoginId)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<LoginIdMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const login = (payload: LoginOptions) => withError(instance.login(payload));\nexport const federatedLogin = (payload: FederatedLoginOptions) =>\n withError(instance.federatedLogin(payload));\nexport const passkeyLogin = (payload?: CustomOptions) => withError(instance.passkeyLogin(payload));\nexport const pickCountryCode = (payload?: CustomOptions) =>\n withError(instance.pickCountryCode(payload));\n\n// Utility Hooks\nexport { useLoginIdentifiers } from '../hooks/utility/login-identifiers';\n\n// Utility Hooks\nexport { usePasskeyAutofill } from '../hooks/utility/passkey-autofill';\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of LoginId\nexport const useLoginId = (): LoginIdMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","LoginId","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","login","payload","federatedLogin","passkeyLogin","pickCountryCode","useLoginId","useMemo"],"mappings":"ojBAeA,MAAMA,EAAWC,EAA+BC,IAG1CC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAA6BN,IACpCO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAASC,GAA0Bd,EAAUH,EAASgB,MAAMC,IAC5DC,EAAkBD,GAC7Bd,EAAUH,EAASkB,eAAeD,IACvBE,EAAgBF,GAA4Bd,EAAUH,EAASmB,aAAaF,IAC5EG,EAAmBH,GAC9Bd,EAAUH,EAASoB,gBAAgBH,IAoBxBI,EAAa,IAAsBC,EAAQ,IAAMtB,EAAU"} |
@@ -1,6 +0,7 @@ | ||
| import type { LoginPasswordMembers, LoginPasswordOptions, FederatedLoginOptions } from '@auth0/auth0-acul-js/login-password'; | ||
| import type { LoginPasswordMembers, LoginPasswordOptions, FederatedLoginOptions, SwitchConnectionOptions } from '@auth0/auth0-acul-js/login-password'; | ||
| export declare const useUser: () => import("@auth0/auth0-acul-js").UserMembers, useTenant: () => import("@auth0/auth0-acul-js").TenantMembers, useBranding: () => import("@auth0/auth0-acul-js").BrandingMembers, useClient: () => import("@auth0/auth0-acul-js").ClientMembers, useOrganization: () => import("@auth0/auth0-acul-js").OrganizationMembers, usePrompt: () => import("@auth0/auth0-acul-js").PromptMembers, useScreen: () => import("@auth0/auth0-acul-js").ScreenMembersOnLoginPassword, useTransaction: () => import("@auth0/auth0-acul-js").TransactionMembersOnLoginPassword, useUntrustedData: () => import("@auth0/auth0-acul-js").UntrustedDataMembers; | ||
| export declare const login: (payload: LoginPasswordOptions) => void | Promise<void>; | ||
| export declare const federatedLogin: (payload: FederatedLoginOptions) => void | Promise<void>; | ||
| export declare const switchConnection: (payload: SwitchConnectionOptions) => void | Promise<void>; | ||
| export { useCurrentScreen, useErrors, useAuth0Themes, type UseErrorOptions, type UseErrorsResult, type ErrorsResult, type ErrorKind, } from '../hooks'; | ||
| export declare const useLoginPassword: () => LoginPasswordMembers; |
@@ -1,2 +0,2 @@ | ||
| import o from"@auth0/auth0-acul-js/login-password";import{useMemo as r}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as e}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";const n=t(o),{withError:m}=e,u=new s(n),{useUser:a,useTenant:i,useBranding:c,useClient:h,useOrganization:p,usePrompt:f,useScreen:j,useTransaction:d,useUntrustedData:x}=u,g=o=>m(n.login(o)),k=o=>m(n.federatedLogin(o)),l=()=>r(()=>n,[]);export{k as federatedLogin,g as login,c as useBranding,h as useClient,l as useLoginPassword,p as useOrganization,f as usePrompt,j as useScreen,i as useTenant,d as useTransaction,x as useUntrustedData,a as useUser}; | ||
| import o from"@auth0/auth0-acul-js/login-password";import{useMemo as r}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as e}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";const n=t(o),{withError:m}=e,u=new s(n),{useUser:i,useTenant:a,useBranding:c,useClient:h,useOrganization:p,usePrompt:f,useScreen:j,useTransaction:d,useUntrustedData:x}=u,g=o=>m(n.login(o)),k=o=>m(n.federatedLogin(o)),l=o=>m(n.switchConnection(o)),w=()=>r(()=>n,[]);export{k as federatedLogin,g as login,l as switchConnection,c as useBranding,h as useClient,w as useLoginPassword,p as useOrganization,f as usePrompt,j as useScreen,a as useTenant,d as useTransaction,x as useUntrustedData,i as useUser}; | ||
| //# sourceMappingURL=login-password.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"login-password.js","sources":["../../src/screens/login-password.tsx"],"sourcesContent":["import LoginPassword from '@auth0/auth0-acul-js/login-password';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n LoginPasswordMembers,\n LoginPasswordOptions,\n FederatedLoginOptions,\n} from '@auth0/auth0-acul-js/login-password';\n\n// Register the singleton instance of LoginPassword\nconst instance = registerScreen<LoginPasswordMembers>(LoginPassword)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<LoginPasswordMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const login = (payload: LoginPasswordOptions) => withError(instance.login(payload));\nexport const federatedLogin = (payload: FederatedLoginOptions) =>\n withError(instance.federatedLogin(payload));\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of LoginPassword\nexport const useLoginPassword = (): LoginPasswordMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","LoginPassword","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","login","payload","federatedLogin","useLoginPassword","useMemo"],"mappings":"8aAcA,MAAMA,EAAWC,EAAqCC,IAGhDC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAAmCN,IAC1CO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAASC,GAAkCd,EAAUH,EAASgB,MAAMC,IACpEC,EAAkBD,GAC7Bd,EAAUH,EAASkB,eAAeD,IAcvBE,EAAmB,IAA4BC,EAAQ,IAAMpB,EAAU"} | ||
| {"version":3,"file":"login-password.js","sources":["../../src/screens/login-password.tsx"],"sourcesContent":["import LoginPassword from '@auth0/auth0-acul-js/login-password';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n LoginPasswordMembers,\n LoginPasswordOptions,\n FederatedLoginOptions,\n SwitchConnectionOptions,\n} from '@auth0/auth0-acul-js/login-password';\n\n// Register the singleton instance of LoginPassword\nconst instance = registerScreen<LoginPasswordMembers>(LoginPassword)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<LoginPasswordMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const login = (payload: LoginPasswordOptions) => withError(instance.login(payload));\nexport const federatedLogin = (payload: FederatedLoginOptions) =>\n withError(instance.federatedLogin(payload));\nexport const switchConnection = (payload: SwitchConnectionOptions) =>\n withError(instance.switchConnection(payload));\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of LoginPassword\nexport const useLoginPassword = (): LoginPasswordMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","LoginPassword","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","login","payload","federatedLogin","switchConnection","useLoginPassword","useMemo"],"mappings":"8aAeA,MAAMA,EAAWC,EAAqCC,IAGhDC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAAmCN,IAC1CO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAASC,GAAkCd,EAAUH,EAASgB,MAAMC,IACpEC,EAAkBD,GAC7Bd,EAAUH,EAASkB,eAAeD,IACvBE,EAAoBF,GAC/Bd,EAAUH,EAASmB,iBAAiBF,IAczBG,EAAmB,IAA4BC,EAAQ,IAAMrB,EAAU"} |
@@ -1,5 +0,6 @@ | ||
| import type { MfaLoginOptionsMembers, LoginEnrollOptions } from '@auth0/auth0-acul-js/mfa-login-options'; | ||
| import type { MfaLoginOptionsMembers, LoginEnrollOptions, CustomOptions } from '@auth0/auth0-acul-js/mfa-login-options'; | ||
| export declare const useUser: () => import("@auth0/auth0-acul-js").UserMembers, useTenant: () => import("@auth0/auth0-acul-js").TenantMembers, useBranding: () => import("@auth0/auth0-acul-js").BrandingMembers, useClient: () => import("@auth0/auth0-acul-js").ClientMembers, useOrganization: () => import("@auth0/auth0-acul-js").OrganizationMembers, usePrompt: () => import("@auth0/auth0-acul-js").PromptMembers, useScreen: () => import("@auth0/auth0-acul-js").ScreenMembersOnMfaLoginOptions, useTransaction: () => import("@auth0/auth0-acul-js").TransactionMembers, useUntrustedData: () => import("@auth0/auth0-acul-js").UntrustedDataMembers; | ||
| export declare const enroll: (payload: LoginEnrollOptions) => void | Promise<void>; | ||
| export declare const returnToPrevious: (payload?: CustomOptions) => void | Promise<void>; | ||
| export { useCurrentScreen, useErrors, useAuth0Themes, type UseErrorOptions, type UseErrorsResult, type ErrorsResult, type ErrorKind, } from '../hooks'; | ||
| export declare const useMfaLoginOptions: () => MfaLoginOptionsMembers; |
@@ -1,2 +0,2 @@ | ||
| import o from"@auth0/auth0-acul-js/mfa-login-options";import{useMemo as r}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as e}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";const n=t(o),{withError:m}=e,u=new s(n),{useUser:a,useTenant:i,useBranding:c,useClient:h,useOrganization:p,usePrompt:f,useScreen:j,useTransaction:x,useUntrustedData:k}=u,l=o=>m(n.enroll(o)),d=()=>r(()=>n,[]);export{l as enroll,c as useBranding,h as useClient,d as useMfaLoginOptions,p as useOrganization,f as usePrompt,j as useScreen,i as useTenant,x as useTransaction,k as useUntrustedData,a as useUser}; | ||
| import o from"@auth0/auth0-acul-js/mfa-login-options";import{useMemo as r}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as e}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";const n=t(o),{withError:m}=e,u=new s(n),{useUser:a,useTenant:i,useBranding:c,useClient:h,useOrganization:p,usePrompt:f,useScreen:j,useTransaction:x,useUntrustedData:k}=u,l=o=>m(n.enroll(o)),T=o=>m(n.returnToPrevious(o)),d=()=>r(()=>n,[]);export{l as enroll,T as returnToPrevious,c as useBranding,h as useClient,d as useMfaLoginOptions,p as useOrganization,f as usePrompt,j as useScreen,i as useTenant,x as useTransaction,k as useUntrustedData,a as useUser}; | ||
| //# sourceMappingURL=mfa-login-options.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"mfa-login-options.js","sources":["../../src/screens/mfa-login-options.tsx"],"sourcesContent":["import MfaLoginOptions from '@auth0/auth0-acul-js/mfa-login-options';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n MfaLoginOptionsMembers,\n LoginEnrollOptions,\n} from '@auth0/auth0-acul-js/mfa-login-options';\n\n// Register the singleton instance of MfaLoginOptions\nconst instance = registerScreen<MfaLoginOptionsMembers>(MfaLoginOptions)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<MfaLoginOptionsMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const enroll = (payload: LoginEnrollOptions) => withError(instance.enroll(payload));\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of MfaLoginOptions\nexport const useMfaLoginOptions = (): MfaLoginOptionsMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","MfaLoginOptions","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","enroll","payload","useMfaLoginOptions","useMemo"],"mappings":"ibAaA,MAAMA,EAAWC,EAAuCC,IAGlDC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAAqCN,IAC5CO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAAUC,GAAgCd,EAAUH,EAASgB,OAAOC,IAcpEC,EAAqB,IAA8BC,EAAQ,IAAMnB,EAAU"} | ||
| {"version":3,"file":"mfa-login-options.js","sources":["../../src/screens/mfa-login-options.tsx"],"sourcesContent":["import MfaLoginOptions from '@auth0/auth0-acul-js/mfa-login-options';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n MfaLoginOptionsMembers,\n LoginEnrollOptions,\n CustomOptions,\n} from '@auth0/auth0-acul-js/mfa-login-options';\n\n// Register the singleton instance of MfaLoginOptions\nconst instance = registerScreen<MfaLoginOptionsMembers>(MfaLoginOptions)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<MfaLoginOptionsMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const enroll = (payload: LoginEnrollOptions) => withError(instance.enroll(payload));\nexport const returnToPrevious = (payload?: CustomOptions) =>\n withError(instance.returnToPrevious(payload));\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of MfaLoginOptions\nexport const useMfaLoginOptions = (): MfaLoginOptionsMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","MfaLoginOptions","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","enroll","payload","returnToPrevious","useMfaLoginOptions","useMemo"],"mappings":"ibAcA,MAAMA,EAAWC,EAAuCC,IAGlDC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAAqCN,IAC5CO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAAUC,GAAgCd,EAAUH,EAASgB,OAAOC,IACpEC,EAAoBD,GAC/Bd,EAAUH,EAASkB,iBAAiBD,IAczBE,EAAqB,IAA8BC,EAAQ,IAAMpB,EAAU"} |
| import type { MfaPushEnrollmentQrMembers, CustomOptions } from '@auth0/auth0-acul-js/mfa-push-enrollment-qr'; | ||
| export declare const useUser: () => import("@auth0/auth0-acul-js").UserMembers, useTenant: () => import("@auth0/auth0-acul-js").TenantMembers, useBranding: () => import("@auth0/auth0-acul-js").BrandingMembers, useClient: () => import("@auth0/auth0-acul-js").ClientMembers, useOrganization: () => import("@auth0/auth0-acul-js").OrganizationMembers, usePrompt: () => import("@auth0/auth0-acul-js").PromptMembers, useScreen: () => import("@auth0/auth0-acul-js").ScreenMembersOnMfaPushEnrollmentQr, useTransaction: () => import("@auth0/auth0-acul-js").TransactionMembers, useUntrustedData: () => import("@auth0/auth0-acul-js").UntrustedDataMembers; | ||
| export declare const pickAuthenticator: (payload?: CustomOptions) => void | Promise<void>; | ||
| export { useMfaPolling } from '../hooks/utility/polling-manager'; | ||
| export { useCurrentScreen, useErrors, useAuth0Themes, type UseErrorOptions, type UseErrorsResult, type ErrorsResult, type ErrorKind, } from '../hooks'; | ||
| export declare const useMfaPushEnrollmentQr: () => MfaPushEnrollmentQrMembers; |
@@ -1,2 +0,2 @@ | ||
| import o from"@auth0/auth0-acul-js/mfa-push-enrollment-qr";import{useMemo as r}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as e}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";const n=t(o),{withError:m}=e,u=new s(n),{useUser:a,useTenant:c,useBranding:i,useClient:h,useOrganization:p,usePrompt:f,useScreen:j,useTransaction:k,useUntrustedData:x}=u,l=o=>m(n.pickAuthenticator(o)),d=()=>r(()=>n,[]);export{l as pickAuthenticator,i as useBranding,h as useClient,d as useMfaPushEnrollmentQr,p as useOrganization,f as usePrompt,j as useScreen,c as useTenant,k as useTransaction,x as useUntrustedData,a as useUser}; | ||
| import o from"@auth0/auth0-acul-js/mfa-push-enrollment-qr";import{useMemo as r}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as e}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";export{useMfaPolling}from"../hooks/utility/polling-manager.js";const n=t(o),{withError:m}=e,u=new s(n),{useUser:a,useTenant:i,useBranding:c,useClient:h,useOrganization:p,usePrompt:f,useScreen:l,useTransaction:j,useUntrustedData:k}=u,x=o=>m(n.pickAuthenticator(o)),g=()=>r(()=>n,[]);export{x as pickAuthenticator,c as useBranding,h as useClient,g as useMfaPushEnrollmentQr,p as useOrganization,f as usePrompt,l as useScreen,i as useTenant,j as useTransaction,k as useUntrustedData,a as useUser}; | ||
| //# sourceMappingURL=mfa-push-enrollment-qr.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"mfa-push-enrollment-qr.js","sources":["../../src/screens/mfa-push-enrollment-qr.tsx"],"sourcesContent":["import MfaPushEnrollmentQr from '@auth0/auth0-acul-js/mfa-push-enrollment-qr';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n MfaPushEnrollmentQrMembers,\n CustomOptions,\n} from '@auth0/auth0-acul-js/mfa-push-enrollment-qr';\n\n// Register the singleton instance of MfaPushEnrollmentQr\nconst instance = registerScreen<MfaPushEnrollmentQrMembers>(MfaPushEnrollmentQr)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<MfaPushEnrollmentQrMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const pickAuthenticator = (payload?: CustomOptions) =>\n withError(instance.pickAuthenticator(payload));\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of MfaPushEnrollmentQr\nexport const useMfaPushEnrollmentQr = (): MfaPushEnrollmentQrMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","MfaPushEnrollmentQr","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","pickAuthenticator","payload","useMfaPushEnrollmentQr","useMemo"],"mappings":"sbAaA,MAAMA,EAAWC,EAA2CC,IAGtDC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAAyCN,IAChDO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAAqBC,GAChCd,EAAUH,EAASgB,kBAAkBC,IAc1BC,EAAyB,IAAkCC,EAAQ,IAAMnB,EAAU"} | ||
| {"version":3,"file":"mfa-push-enrollment-qr.js","sources":["../../src/screens/mfa-push-enrollment-qr.tsx"],"sourcesContent":["import MfaPushEnrollmentQr from '@auth0/auth0-acul-js/mfa-push-enrollment-qr';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n MfaPushEnrollmentQrMembers,\n CustomOptions,\n} from '@auth0/auth0-acul-js/mfa-push-enrollment-qr';\n\n// Register the singleton instance of MfaPushEnrollmentQr\nconst instance = registerScreen<MfaPushEnrollmentQrMembers>(MfaPushEnrollmentQr)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<MfaPushEnrollmentQrMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const pickAuthenticator = (payload?: CustomOptions) =>\n withError(instance.pickAuthenticator(payload));\n\n// Utility Hooks\nexport { useMfaPolling } from '../hooks/utility/polling-manager';\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of MfaPushEnrollmentQr\nexport const useMfaPushEnrollmentQr = (): MfaPushEnrollmentQrMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","MfaPushEnrollmentQr","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","pickAuthenticator","payload","useMfaPushEnrollmentQr","useMemo"],"mappings":"qfAaA,MAAMA,EAAWC,EAA2CC,IAGtDC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAAyCN,IAChDO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAAqBC,GAChCd,EAAUH,EAASgB,kBAAkBC,IAiB1BC,EAAyB,IAAkCC,EAAQ,IAAMnB,EAAU"} |
@@ -6,4 +6,6 @@ import type { PhoneIdentifierChallengeMembers, PhoneChallengeOptions, CustomOptions } from '@auth0/auth0-acul-js/phone-identifier-challenge'; | ||
| export declare const returnToPrevious: (payload?: CustomOptions) => void | Promise<void>; | ||
| export declare const switchToVoice: (payload?: CustomOptions) => void | Promise<void>; | ||
| export declare const switchToText: (payload?: CustomOptions) => void | Promise<void>; | ||
| export { useResend } from '../hooks/utility/resend-manager'; | ||
| export { useCurrentScreen, useErrors, useAuth0Themes, type UseErrorOptions, type UseErrorsResult, type ErrorsResult, type ErrorKind, } from '../hooks'; | ||
| export declare const usePhoneIdentifierChallenge: () => PhoneIdentifierChallengeMembers; |
@@ -1,2 +0,2 @@ | ||
| import e from"@auth0/auth0-acul-js/phone-identifier-challenge";import{useMemo as o}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as r}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";export{useResend}from"../hooks/utility/resend-manager.js";const n=t(e),{withError:m}=r,u=new s(n),{useUser:i,useTenant:a,useBranding:h,useClient:c,useOrganization:p,usePrompt:f,useScreen:d,useTransaction:j,useUntrustedData:l}=u,x=e=>m(n.submitPhoneChallenge(e)),k=e=>m(n.resendCode(e)),g=e=>m(n.returnToPrevious(e)),C=()=>o(()=>n,[]);export{k as resendCode,g as returnToPrevious,x as submitPhoneChallenge,h as useBranding,c as useClient,p as useOrganization,C as usePhoneIdentifierChallenge,f as usePrompt,d as useScreen,a as useTenant,j as useTransaction,l as useUntrustedData,i as useUser}; | ||
| import e from"@auth0/auth0-acul-js/phone-identifier-challenge";import{useMemo as o}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as r}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as s}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";export{useResend}from"../hooks/utility/resend-manager.js";const n=t(e),{withError:m}=r,u=new s(n),{useUser:i,useTenant:a,useBranding:h,useClient:c,useOrganization:p,usePrompt:f,useScreen:d,useTransaction:j,useUntrustedData:x}=u,l=e=>m(n.submitPhoneChallenge(e)),T=e=>m(n.resendCode(e)),k=e=>m(n.returnToPrevious(e)),g=e=>m(n.switchToVoice(e)),w=e=>m(n.switchToText(e)),C=()=>o(()=>n,[]);export{T as resendCode,k as returnToPrevious,l as submitPhoneChallenge,w as switchToText,g as switchToVoice,h as useBranding,c as useClient,p as useOrganization,C as usePhoneIdentifierChallenge,f as usePrompt,d as useScreen,a as useTenant,j as useTransaction,x as useUntrustedData,i as useUser}; | ||
| //# sourceMappingURL=phone-identifier-challenge.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"phone-identifier-challenge.js","sources":["../../src/screens/phone-identifier-challenge.tsx"],"sourcesContent":["import PhoneIdentifierChallenge from '@auth0/auth0-acul-js/phone-identifier-challenge';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n PhoneIdentifierChallengeMembers,\n PhoneChallengeOptions,\n CustomOptions,\n} from '@auth0/auth0-acul-js/phone-identifier-challenge';\n\n// Register the singleton instance of PhoneIdentifierChallenge\nconst instance = registerScreen<PhoneIdentifierChallengeMembers>(PhoneIdentifierChallenge)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<PhoneIdentifierChallengeMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const submitPhoneChallenge = (payload: PhoneChallengeOptions) =>\n withError(instance.submitPhoneChallenge(payload));\nexport const resendCode = (payload?: CustomOptions) => withError(instance.resendCode(payload));\nexport const returnToPrevious = (payload?: CustomOptions) =>\n withError(instance.returnToPrevious(payload));\n\n// Utility Hooks\nexport { useResend } from '../hooks/utility/resend-manager';\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of PhoneIdentifierChallenge\nexport const usePhoneIdentifierChallenge = (): PhoneIdentifierChallengeMembers =>\n useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","PhoneIdentifierChallenge","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","submitPhoneChallenge","payload","resendCode","returnToPrevious","usePhoneIdentifierChallenge","useMemo"],"mappings":"ofAcA,MAAMA,EAAWC,EAAgDC,IAG3DC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAA8CN,IACrDO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAAwBC,GACnCd,EAAUH,EAASgB,qBAAqBC,IAC7BC,EAAcD,GAA4Bd,EAAUH,EAASkB,WAAWD,IACxEE,EAAoBF,GAC/Bd,EAAUH,EAASmB,iBAAiBF,IAiBzBG,EAA8B,IACzCC,EAAQ,IAAMrB,EAAU"} | ||
| {"version":3,"file":"phone-identifier-challenge.js","sources":["../../src/screens/phone-identifier-challenge.tsx"],"sourcesContent":["import PhoneIdentifierChallenge from '@auth0/auth0-acul-js/phone-identifier-challenge';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n PhoneIdentifierChallengeMembers,\n PhoneChallengeOptions,\n CustomOptions,\n} from '@auth0/auth0-acul-js/phone-identifier-challenge';\n\n// Register the singleton instance of PhoneIdentifierChallenge\nconst instance = registerScreen<PhoneIdentifierChallengeMembers>(PhoneIdentifierChallenge)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<PhoneIdentifierChallengeMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const submitPhoneChallenge = (payload: PhoneChallengeOptions) =>\n withError(instance.submitPhoneChallenge(payload));\nexport const resendCode = (payload?: CustomOptions) => withError(instance.resendCode(payload));\nexport const returnToPrevious = (payload?: CustomOptions) =>\n withError(instance.returnToPrevious(payload));\nexport const switchToVoice = (payload?: CustomOptions) =>\n withError(instance.switchToVoice(payload));\nexport const switchToText = (payload?: CustomOptions) => withError(instance.switchToText(payload));\n\n// Utility Hooks\nexport { useResend } from '../hooks/utility/resend-manager';\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of PhoneIdentifierChallenge\nexport const usePhoneIdentifierChallenge = (): PhoneIdentifierChallengeMembers =>\n useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","PhoneIdentifierChallenge","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","submitPhoneChallenge","payload","resendCode","returnToPrevious","switchToVoice","switchToText","usePhoneIdentifierChallenge","useMemo"],"mappings":"ofAcA,MAAMA,EAAWC,EAAgDC,IAG3DC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAA8CN,IACrDO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAAwBC,GACnCd,EAAUH,EAASgB,qBAAqBC,IAC7BC,EAAcD,GAA4Bd,EAAUH,EAASkB,WAAWD,IACxEE,EAAoBF,GAC/Bd,EAAUH,EAASmB,iBAAiBF,IACzBG,EAAiBH,GAC5Bd,EAAUH,EAASoB,cAAcH,IACtBI,EAAgBJ,GAA4Bd,EAAUH,EAASqB,aAAaJ,IAiB5EK,EAA8B,IACzCC,EAAQ,IAAMvB,EAAU"} |
@@ -1,7 +0,8 @@ | ||
| import type { SignupPasswordMembers, SignupPasswordOptions, FederatedSignupOptions } from '@auth0/auth0-acul-js/signup-password'; | ||
| import type { SignupPasswordMembers, SignupPasswordOptions, FederatedSignupOptions, SwitchConnectionOptions } from '@auth0/auth0-acul-js/signup-password'; | ||
| export declare const useUser: () => import("@auth0/auth0-acul-js").UserMembers, useTenant: () => import("@auth0/auth0-acul-js").TenantMembers, useBranding: () => import("@auth0/auth0-acul-js").BrandingMembers, useClient: () => import("@auth0/auth0-acul-js").ClientMembers, useOrganization: () => import("@auth0/auth0-acul-js").OrganizationMembers, usePrompt: () => import("@auth0/auth0-acul-js").PromptMembers, useScreen: () => import("@auth0/auth0-acul-js").ScreenMembersOnSignupPassword, useTransaction: () => import("@auth0/auth0-acul-js").TransactionMembersOnSignupPassword, useUntrustedData: () => import("@auth0/auth0-acul-js").UntrustedDataMembers; | ||
| export declare const signup: (payload: SignupPasswordOptions) => void | Promise<void>; | ||
| export declare const federatedSignup: (payload: FederatedSignupOptions) => void | Promise<void>; | ||
| export declare const switchConnection: (payload: SwitchConnectionOptions) => void | Promise<void>; | ||
| export { usePasswordValidation } from '../hooks/utility/validate-password'; | ||
| export { useCurrentScreen, useErrors, useAuth0Themes, type UseErrorOptions, type UseErrorsResult, type ErrorsResult, type ErrorKind, } from '../hooks'; | ||
| export declare const useSignupPassword: () => SignupPasswordMembers; |
@@ -1,2 +0,2 @@ | ||
| import o from"@auth0/auth0-acul-js/signup-password";import{useMemo as r}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as s}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as e}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";export{usePasswordValidation}from"../hooks/utility/validate-password.js";const n=t(o),{withError:m}=s,u=new e(n),{useUser:a,useTenant:i,useBranding:p,useClient:c,useOrganization:h,usePrompt:d,useScreen:f,useTransaction:j,useUntrustedData:x}=u,k=o=>m(n.signup(o)),g=o=>m(n.federatedSignup(o)),l=()=>r(()=>n,[]);export{g as federatedSignup,k as signup,p as useBranding,c as useClient,h as useOrganization,d as usePrompt,f as useScreen,l as useSignupPassword,i as useTenant,j as useTransaction,x as useUntrustedData,a as useUser}; | ||
| import o from"@auth0/auth0-acul-js/signup-password";import{useMemo as r}from"react";export{useAuth0Themes}from"../hooks/common/auth0-themes.js";export{useCurrentScreen}from"../hooks/common/current-screen.js";import{errorManager as s}from"../hooks/common/errors.js";export{useErrors}from"../hooks/common/errors.js";import{ContextHooks as e}from"../hooks/context/index.js";import{registerScreen as t}from"../state/instance-store.js";export{usePasswordValidation}from"../hooks/utility/validate-password.js";const n=t(o),{withError:m}=s,u=new e(n),{useUser:a,useTenant:i,useBranding:c,useClient:p,useOrganization:h,usePrompt:d,useScreen:f,useTransaction:j,useUntrustedData:x}=u,k=o=>m(n.signup(o)),w=o=>m(n.federatedSignup(o)),g=o=>m(n.switchConnection(o)),l=()=>r(()=>n,[]);export{w as federatedSignup,k as signup,g as switchConnection,c as useBranding,p as useClient,h as useOrganization,d as usePrompt,f as useScreen,l as useSignupPassword,i as useTenant,j as useTransaction,x as useUntrustedData,a as useUser}; | ||
| //# sourceMappingURL=signup-password.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"signup-password.js","sources":["../../src/screens/signup-password.tsx"],"sourcesContent":["import SignupPassword from '@auth0/auth0-acul-js/signup-password';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n SignupPasswordMembers,\n SignupPasswordOptions,\n FederatedSignupOptions,\n} from '@auth0/auth0-acul-js/signup-password';\n\n// Register the singleton instance of SignupPassword\nconst instance = registerScreen<SignupPasswordMembers>(SignupPassword)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<SignupPasswordMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const signup = (payload: SignupPasswordOptions) => withError(instance.signup(payload));\nexport const federatedSignup = (payload: FederatedSignupOptions) =>\n withError(instance.federatedSignup(payload));\n\n// Utility Hooks\nexport { usePasswordValidation } from '../hooks/utility/validate-password';\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of SignupPassword\nexport const useSignupPassword = (): SignupPasswordMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","SignupPassword","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","signup","payload","federatedSignup","useSignupPassword","useMemo"],"mappings":"wfAcA,MAAMA,EAAWC,EAAsCC,IAGjDC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAAoCN,IAC3CO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAAUC,GAAmCd,EAAUH,EAASgB,OAAOC,IACvEC,EAAmBD,GAC9Bd,EAAUH,EAASkB,gBAAgBD,IAiBxBE,EAAoB,IAA6BC,EAAQ,IAAMpB,EAAU"} | ||
| {"version":3,"file":"signup-password.js","sources":["../../src/screens/signup-password.tsx"],"sourcesContent":["import SignupPassword from '@auth0/auth0-acul-js/signup-password';\nimport { useMemo } from 'react';\n\nimport { ContextHooks } from '../hooks';\nimport { errorManager } from '../hooks';\nimport { registerScreen } from '../state/instance-store';\n\nimport type {\n SignupPasswordMembers,\n SignupPasswordOptions,\n FederatedSignupOptions,\n SwitchConnectionOptions,\n} from '@auth0/auth0-acul-js/signup-password';\n\n// Register the singleton instance of SignupPassword\nconst instance = registerScreen<SignupPasswordMembers>(SignupPassword)!;\n\n// Error wrapper\nconst { withError } = errorManager;\n\n// Context hooks\nconst factory = new ContextHooks<SignupPasswordMembers>(instance);\nexport const {\n useUser,\n useTenant,\n useBranding,\n useClient,\n useOrganization,\n usePrompt,\n useScreen,\n useTransaction,\n useUntrustedData,\n} = factory;\n\n// Submit functions\nexport const signup = (payload: SignupPasswordOptions) => withError(instance.signup(payload));\nexport const federatedSignup = (payload: FederatedSignupOptions) =>\n withError(instance.federatedSignup(payload));\nexport const switchConnection = (payload: SwitchConnectionOptions) =>\n withError(instance.switchConnection(payload));\n\n// Utility Hooks\nexport { usePasswordValidation } from '../hooks/utility/validate-password';\n\n// Common hooks\nexport {\n useCurrentScreen,\n useErrors,\n useAuth0Themes,\n type UseErrorOptions,\n type UseErrorsResult,\n type ErrorsResult,\n type ErrorKind,\n} from '../hooks';\n\n// Main instance hook. Returns singleton instance of SignupPassword\nexport const useSignupPassword = (): SignupPasswordMembers => useMemo(() => instance, []);\n\n// Export all types from the core SDK for this screen\n"],"names":["instance","registerScreen","SignupPassword","withError","errorManager","factory","ContextHooks","useUser","useTenant","useBranding","useClient","useOrganization","usePrompt","useScreen","useTransaction","useUntrustedData","signup","payload","federatedSignup","switchConnection","useSignupPassword","useMemo"],"mappings":"wfAeA,MAAMA,EAAWC,EAAsCC,IAGjDC,UAAEA,GAAcC,EAGhBC,EAAU,IAAIC,EAAoCN,IAC3CO,QACXA,EAAOC,UACPA,EAASC,YACTA,EAAWC,UACXA,EAASC,gBACTA,EAAeC,UACfA,EAASC,UACTA,EAASC,eACTA,EAAcC,iBACdA,GACEV,EAGSW,EAAUC,GAAmCd,EAAUH,EAASgB,OAAOC,IACvEC,EAAmBD,GAC9Bd,EAAUH,EAASkB,gBAAgBD,IACxBE,EAAoBF,GAC/Bd,EAAUH,EAASmB,iBAAiBF,IAiBzBG,EAAoB,IAA6BC,EAAQ,IAAMrB,EAAU"} |
@@ -7,8 +7,8 @@ import type { Error as Auth0Error } from '@auth0/auth0-acul-js'; | ||
| } | ||
| export type ErrorKind = 'server' | 'client' | 'developer'; | ||
| export type ErrorKind = 'auth0' | 'validation' | 'configuration'; | ||
| export declare const ERROR_KINDS: ErrorKind[]; | ||
| type Bucket = { | ||
| server: ReadonlyArray<ErrorItem>; | ||
| client: ReadonlyArray<ErrorItem>; | ||
| developer: ReadonlyArray<ErrorItem>; | ||
| auth0: ReadonlyArray<ErrorItem>; | ||
| validation: ReadonlyArray<ErrorItem>; | ||
| configuration: ReadonlyArray<ErrorItem>; | ||
| }; | ||
@@ -15,0 +15,0 @@ type Listener = () => void; |
@@ -1,2 +0,2 @@ | ||
| const e=["server","client","developer"];function t(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].id!==t[r].id)return!1;return!0}const r=Object.freeze({server:Object.freeze([]),client:Object.freeze([]),developer:Object.freeze([])});let s=0;const i=new class{constructor(){this.bucket=r,this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}snapshot(){return this.bucket}normalize(e){return Object.freeze(e.map(e=>Object.freeze({...e,id:e.id??`${Date.now()}-${s++}`})))}replace(e,r){const s=this.normalize(r);t(this.bucket[e],s)||(this.bucket=Object.freeze({...this.bucket,[e]:s}),this.notify())}replacePartial(e,r,s){const i=this.normalize(r),c=this.bucket[e].filter(e=>e.field!==s),n=Object.freeze([...c,...i]);t(this.bucket[e],n)||(this.bucket=Object.freeze({...this.bucket,[e]:n}),this.notify())}push(e,t){const r=Array.isArray(t)?t:[t];if(0===r.length)return;const s=Object.freeze([...this.bucket[e],...this.normalize(r)]);this.bucket=Object.freeze({...this.bucket,[e]:s}),this.notify()}clear(t=e){let r=!1;const s={...this.bucket};for(const e of t)this.bucket[e].length>0&&(s[e]=Object.freeze([]),r=!0);r&&(this.bucket=Object.freeze(s),this.notify())}remove(t=e,r){const s="string"==typeof r?e=>e.id===r:r;let i=!1;const c={...this.bucket};for(const e of t){const t=this.bucket[e].filter(e=>!s(e));t.length!==this.bucket[e].length&&(c[e]=Object.freeze(t),i=!0)}i&&(this.bucket=Object.freeze(c),this.notify())}notify(){for(const e of this.listeners)e()}};export{e as ERROR_KINDS,i as errorStore}; | ||
| const e=["auth0","validation","configuration"];function t(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i].id!==t[i].id)return!1;return!0}const i=Object.freeze({auth0:Object.freeze([]),validation:Object.freeze([]),configuration:Object.freeze([])});let s=0;const r=new class{constructor(){this.bucket=i,this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}snapshot(){return this.bucket}normalize(e){return Object.freeze(e.map(e=>Object.freeze({...e,id:e.id??`${Date.now()}-${s++}`})))}replace(e,i){const s=this.normalize(i);t(this.bucket[e],s)||(this.bucket=Object.freeze({...this.bucket,[e]:s}),this.notify())}replacePartial(e,i,s){const r=this.normalize(i),c=this.bucket[e].filter(e=>e.field!==s),n=Object.freeze([...c,...r]);t(this.bucket[e],n)||(this.bucket=Object.freeze({...this.bucket,[e]:n}),this.notify())}push(e,t){const i=Array.isArray(t)?t:[t];if(0===i.length)return;const s=Object.freeze([...this.bucket[e],...this.normalize(i)]);this.bucket=Object.freeze({...this.bucket,[e]:s}),this.notify()}clear(t=e){let i=!1;const s={...this.bucket};for(const e of t)this.bucket[e].length>0&&(s[e]=Object.freeze([]),i=!0);i&&(this.bucket=Object.freeze(s),this.notify())}remove(t=e,i){const s="string"==typeof i?e=>e.id===i:i;let r=!1;const c={...this.bucket};for(const e of t){const t=this.bucket[e].filter(e=>!s(e));t.length!==this.bucket[e].length&&(c[e]=Object.freeze(t),r=!0)}r&&(this.bucket=Object.freeze(c),this.notify())}notify(){for(const e of this.listeners)e()}};export{e as ERROR_KINDS,r as errorStore}; | ||
| //# sourceMappingURL=error-store.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"error-store.js","sources":["../../src/state/error-store.ts"],"sourcesContent":["import type { Error as Auth0Error } from '@auth0/auth0-acul-js';\n\nexport interface ErrorItem extends Auth0Error {\n id: string;\n label?: string;\n kind?: ErrorKind;\n}\n\nexport type ErrorKind = 'server' | 'client' | 'developer';\n\nexport const ERROR_KINDS: ErrorKind[] = ['server', 'client', 'developer'];\n\ntype Bucket = {\n server: ReadonlyArray<ErrorItem>;\n client: ReadonlyArray<ErrorItem>;\n developer: ReadonlyArray<ErrorItem>;\n};\n\ntype Listener = () => void;\n\n/** Compare two error lists by id only for maximal speed. */\nfunction listsEqual(a: ReadonlyArray<ErrorItem>, b: ReadonlyArray<ErrorItem>) {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i].id !== b[i].id) return false;\n }\n return true;\n}\n\nconst EMPTY_BUCKET: Bucket = Object.freeze({\n server: Object.freeze([]),\n client: Object.freeze([]),\n developer: Object.freeze([]),\n});\n\nlet nextId = 0;\nconst genId = () => `${Date.now()}-${nextId++}`;\n\n/**\n * Global error store for ACUL (one screen per page).\n * - Holds a single bucket of errors across the current page.\n * - Generates stable ids for every inserted error.\n * - Emits immutable snapshots to subscribers.\n */\nclass ErrorStore {\n private bucket: Bucket = EMPTY_BUCKET;\n private listeners: Set<Listener> = new Set();\n\n subscribe(cb: Listener): () => void {\n this.listeners.add(cb);\n return () => this.listeners.delete(cb);\n }\n\n snapshot(): Readonly<Bucket> {\n return this.bucket;\n }\n\n /** Add ids and freeze an array of ErrorItem-like objects. */\n private normalize(\n list: Array<Omit<ErrorItem, 'id'> & { id?: string }>\n ): ReadonlyArray<ErrorItem> {\n return Object.freeze(\n list.map((e) =>\n Object.freeze({\n ...e,\n id: e.id ?? genId(),\n })\n )\n );\n }\n\n /** Replace an entire kind with a new list (generating ids if needed). */\n replace(kind: ErrorKind, list: Array<Omit<ErrorItem, 'id'> | ErrorItem>) {\n const nextList = this.normalize(list);\n if (listsEqual(this.bucket[kind], nextList)) return;\n\n this.bucket = Object.freeze({\n ...this.bucket,\n [kind]: nextList,\n });\n this.notify();\n }\n\n /**\n * Replace only errors for a specific field within a kind.\n * - Keeps all existing errors for other fields.\n * - Normalizes incoming errors and replaces matching field ones.\n */\n replacePartial(kind: ErrorKind, list: Array<Omit<ErrorItem, 'id'> | ErrorItem>, field: string) {\n const incoming = this.normalize(list);\n const existing = this.bucket[kind].filter((e) => e.field !== field);\n const nextKindList = Object.freeze([...existing, ...incoming]);\n\n if (listsEqual(this.bucket[kind], nextKindList)) return;\n\n this.bucket = Object.freeze({\n ...this.bucket,\n [kind]: nextKindList,\n });\n this.notify();\n }\n\n /** Append one or more items to a kind. */\n push(\n kind: ErrorKind,\n list: Omit<ErrorItem, 'id'> | ErrorItem | Array<Omit<ErrorItem, 'id'> | ErrorItem>\n ) {\n const arr = Array.isArray(list) ? list : [list];\n if (arr.length === 0) return;\n\n const nextKindList = Object.freeze([...this.bucket[kind], ...this.normalize(arr)]);\n this.bucket = Object.freeze({\n ...this.bucket,\n [kind]: nextKindList,\n });\n this.notify();\n }\n\n /** Clear one or more kinds (default: all kinds). */\n clear(kinds: ErrorKind[] = ERROR_KINDS) {\n let changed = false;\n const next: Bucket = { ...this.bucket };\n\n for (const k of kinds) {\n if (this.bucket[k].length > 0) {\n next[k] = Object.freeze([]);\n changed = true;\n }\n }\n\n if (!changed) return;\n this.bucket = Object.freeze(next);\n this.notify();\n }\n\n /**\n * Remove errors that match a given id or predicate from specified kinds.\n */\n remove(kinds: ErrorKind[] = ERROR_KINDS, test: string | ((e: ErrorItem) => boolean)) {\n const isMatch = typeof test === 'string' ? (e: ErrorItem) => e.id === test : test;\n\n let changed = false;\n const next: Bucket = { ...this.bucket };\n\n for (const k of kinds) {\n const filtered = this.bucket[k].filter((e) => !isMatch(e));\n if (filtered.length !== this.bucket[k].length) {\n next[k] = Object.freeze(filtered);\n changed = true;\n }\n }\n\n if (!changed) return;\n this.bucket = Object.freeze(next);\n this.notify();\n }\n\n private notify() {\n for (const cb of this.listeners) cb();\n }\n}\n\nexport const errorStore = new ErrorStore();\n"],"names":["ERROR_KINDS","listsEqual","a","b","length","i","id","EMPTY_BUCKET","Object","freeze","server","client","developer","nextId","errorStore","constructor","this","bucket","listeners","Set","subscribe","cb","add","delete","snapshot","normalize","list","map","e","Date","now","replace","kind","nextList","notify","replacePartial","field","incoming","existing","filter","nextKindList","push","arr","Array","isArray","clear","kinds","changed","next","k","remove","test","isMatch","filtered"],"mappings":"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"} | ||
| {"version":3,"file":"error-store.js","sources":["../../src/state/error-store.ts"],"sourcesContent":["import type { Error as Auth0Error } from '@auth0/auth0-acul-js';\n\nexport interface ErrorItem extends Auth0Error {\n id: string;\n label?: string;\n kind?: ErrorKind;\n}\n\nexport type ErrorKind = 'auth0' | 'validation' | 'configuration';\n\nexport const ERROR_KINDS: ErrorKind[] = ['auth0', 'validation', 'configuration'];\n\ntype Bucket = {\n auth0: ReadonlyArray<ErrorItem>;\n validation: ReadonlyArray<ErrorItem>;\n configuration: ReadonlyArray<ErrorItem>;\n};\n\ntype Listener = () => void;\n\n/** Compare two error lists by id only for maximal speed. */\nfunction listsEqual(a: ReadonlyArray<ErrorItem>, b: ReadonlyArray<ErrorItem>) {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i].id !== b[i].id) return false;\n }\n return true;\n}\n\nconst EMPTY_BUCKET: Bucket = Object.freeze({\n auth0: Object.freeze([]),\n validation: Object.freeze([]),\n configuration: Object.freeze([]),\n});\n\nlet nextId = 0;\nconst genId = () => `${Date.now()}-${nextId++}`;\n\n/**\n * Global error store for ACUL (one screen per page).\n * - Holds a single bucket of errors across the current page.\n * - Generates stable ids for every inserted error.\n * - Emits immutable snapshots to subscribers.\n */\nclass ErrorStore {\n private bucket: Bucket = EMPTY_BUCKET;\n private listeners: Set<Listener> = new Set();\n\n subscribe(cb: Listener): () => void {\n this.listeners.add(cb);\n return () => this.listeners.delete(cb);\n }\n\n snapshot(): Readonly<Bucket> {\n return this.bucket;\n }\n\n /** Add ids and freeze an array of ErrorItem-like objects. */\n private normalize(\n list: Array<Omit<ErrorItem, 'id'> & { id?: string }>\n ): ReadonlyArray<ErrorItem> {\n return Object.freeze(\n list.map((e) =>\n Object.freeze({\n ...e,\n id: e.id ?? genId(),\n })\n )\n );\n }\n\n /** Replace an entire kind with a new list (generating ids if needed). */\n replace(kind: ErrorKind, list: Array<Omit<ErrorItem, 'id'> | ErrorItem>) {\n const nextList = this.normalize(list);\n if (listsEqual(this.bucket[kind], nextList)) return;\n\n this.bucket = Object.freeze({\n ...this.bucket,\n [kind]: nextList,\n });\n this.notify();\n }\n\n /**\n * Replace only errors for a specific field within a kind.\n * - Keeps all existing errors for other fields.\n * - Normalizes incoming errors and replaces matching field ones.\n */\n replacePartial(kind: ErrorKind, list: Array<Omit<ErrorItem, 'id'> | ErrorItem>, field: string) {\n const incoming = this.normalize(list);\n const existing = this.bucket[kind].filter((e) => e.field !== field);\n const nextKindList = Object.freeze([...existing, ...incoming]);\n\n if (listsEqual(this.bucket[kind], nextKindList)) return;\n\n this.bucket = Object.freeze({\n ...this.bucket,\n [kind]: nextKindList,\n });\n this.notify();\n }\n\n /** Append one or more items to a kind. */\n push(\n kind: ErrorKind,\n list: Omit<ErrorItem, 'id'> | ErrorItem | Array<Omit<ErrorItem, 'id'> | ErrorItem>\n ) {\n const arr = Array.isArray(list) ? list : [list];\n if (arr.length === 0) return;\n\n const nextKindList = Object.freeze([...this.bucket[kind], ...this.normalize(arr)]);\n this.bucket = Object.freeze({\n ...this.bucket,\n [kind]: nextKindList,\n });\n this.notify();\n }\n\n /** Clear one or more kinds (default: all kinds). */\n clear(kinds: ErrorKind[] = ERROR_KINDS) {\n let changed = false;\n const next: Bucket = { ...this.bucket };\n\n for (const k of kinds) {\n if (this.bucket[k].length > 0) {\n next[k] = Object.freeze([]);\n changed = true;\n }\n }\n\n if (!changed) return;\n this.bucket = Object.freeze(next);\n this.notify();\n }\n\n /**\n * Remove errors that match a given id or predicate from specified kinds.\n */\n remove(kinds: ErrorKind[] = ERROR_KINDS, test: string | ((e: ErrorItem) => boolean)) {\n const isMatch = typeof test === 'string' ? (e: ErrorItem) => e.id === test : test;\n\n let changed = false;\n const next: Bucket = { ...this.bucket };\n\n for (const k of kinds) {\n const filtered = this.bucket[k].filter((e) => !isMatch(e));\n if (filtered.length !== this.bucket[k].length) {\n next[k] = Object.freeze(filtered);\n changed = true;\n }\n }\n\n if (!changed) return;\n this.bucket = Object.freeze(next);\n this.notify();\n }\n\n private notify() {\n for (const cb of this.listeners) cb();\n }\n}\n\nexport const errorStore = new ErrorStore();\n"],"names":["ERROR_KINDS","listsEqual","a","b","length","i","id","EMPTY_BUCKET","Object","freeze","auth0","validation","configuration","nextId","errorStore","constructor","this","bucket","listeners","Set","subscribe","cb","add","delete","snapshot","normalize","list","map","e","Date","now","replace","kind","nextList","notify","replacePartial","field","incoming","existing","filter","nextKindList","push","arr","Array","isArray","clear","kinds","changed","next","k","remove","test","isMatch","filtered"],"mappings":"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"} |
@@ -1,2 +0,2 @@ | ||
| globalThis.__ACUL_SDK_NAME__="@auth0/auth0-acul-react",globalThis.__ACUL_SDK_VERSION__="1.0.0-alpha.1"; | ||
| globalThis.__ACUL_SDK_NAME__="@auth0/auth0-acul-react",globalThis.__ACUL_SDK_VERSION__="1.0.0-alpha.2"; | ||
| //# sourceMappingURL=telemetry.js.map |
+4
-3
| { | ||
| "name": "@auth0/auth0-acul-react", | ||
| "version": "1.0.0-alpha.1", | ||
| "version": "1.0.0-alpha.2", | ||
| "main": "dist/index.js", | ||
@@ -17,3 +17,4 @@ "type": "module", | ||
| "docs": "typedoc --options typedoc.js", | ||
| "postbuild": "npm run docs" | ||
| "postbuild": "npm run docs", | ||
| "build:local": "NODE_ENV=production rollup -c rollup.config.mjs" | ||
| }, | ||
@@ -53,3 +54,3 @@ "author": "Auth0", | ||
| "dependencies": { | ||
| "@auth0/auth0-acul-js": "1.0.0-alpha.1" | ||
| "@auth0/auth0-acul-js": "1.0.0-alpha.2" | ||
| }, | ||
@@ -56,0 +57,0 @@ "files": [ |
+213
-10
| # Auth0 ACUL React SDK | ||
|  | ||
| <div align="center"> | ||
@@ -14,3 +16,3 @@ | ||
| π [Documentation](#-documentation) | π [Getting Started](#-getting-started) | π» [API Reference](#-api-reference) | π¬ [Feedback](#-feedback) | ||
| π [Documentation](#documentation) | π [Getting Started](#getting-started) | π» [API Reference](#api-reference) | πͺ [Hooks](#hooks) | [Examples](#examples) | π¬ [Feedback](#feedback) | ||
@@ -27,4 +29,21 @@ </div> | ||
| ## Installation | ||
| <a id="documentation"></a> | ||
| ## π Documentation | ||
| - [Quickstart](https://auth0.com/docs/customize/login-pages/advanced-customizations/getting-started/sdk-quickstart) - our guide for setting up the SDK on your app. | ||
| - [Guides](https://auth0.com/docs/customize/login-pages/advanced-customizations/screens) - more guides for common use cases | ||
| - [Examples](https://github.com/auth0/universal-login/tree/master/packages/auth0-acul-react/examples) - code snippets for different customization use cases. | ||
| <a id="getting-started"></a> | ||
| ## π Getting started | ||
| ### Prerequisites | ||
| Before starting, ensure that you have the following setup: | ||
| 1. **Custom Domain**: Ensure that a custom domain is configured for your Auth0 tenant. | ||
| 2. **Screen Configuration**: Set up the required authentication screens within your Auth0 flow. | ||
| For detailed steps, refer to the [Configure ACUL Screens](https://auth0.com/docs/customize/login-pages/advanced-customizations/getting-started/configure-acul-screens). | ||
| ### Installation | ||
| ```bash | ||
@@ -38,7 +57,9 @@ npm install @auth0/auth0-acul-react | ||
| ``` | ||
| --- | ||
| ## Importing the SDK | ||
| The SDK supports `partial imports` for each screen, allowing you to include only the code you need for your specific use case. This helps keep your bundle size small and improves performance. | ||
| Also, you can use a `root import` to load all screens from a single bundle if your app requires it. | ||
| ### Partial Imports | ||
| ### Importing the SDK | ||
| The SDK supports `partial imports` for each screen, allowing you to include only the code you need for your specific use case. This helps keep your bundle size small and improves performance. | ||
| Also, you can use a `root import` to load all screens from a single bundle if your app requires it. | ||
| #### Partial Imports | ||
| Each screen has its own set of hooks and methods. You can import only what you need for the screen you're building. | ||
@@ -77,3 +98,3 @@ | ||
| ### Root Imports | ||
| #### Root Imports | ||
@@ -101,3 +122,3 @@ The SDK also supports a root import, which lets you load all screens from a single bundle. | ||
| ### Types / Interfaces | ||
| #### Types / Interfaces | ||
| Typescript types and interfaces can be imported from `@auth0/auth0-acul-react/types` for type safety and better DX. | ||
@@ -118,6 +139,188 @@ ```tsx | ||
| <a id="api-reference"></a> | ||
| ## π» API Reference | ||
| ### Screens | ||
| | No. | Prompt | Screen Name | Documentation Link | | ||
| |--------|--------------------|-------------------|--------------------------------------------------------------------------------------------| | ||
| | 1 | login | login | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.Login) | | ||
| | 2 | loginId | login-id | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.LoginId) | | ||
| | 3 | login-password | login-password | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.LoginPassword) | | ||
| | 4 | signup-id | signup-id | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.SignupId) | | ||
| | 5 | signup-password | signup-password | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.SignupPassword) | | ||
| <details> | ||
| <summary>Explore more screens...</summary> | ||
| | No. | Prompt | Screen Name | Documentation Link | | ||
| |--------|--------------------------------|-------------------------------------------|-------------------------------------------------------------------------------------------------------| | ||
| | 6 | login-passwordless | login-passwordless-email-code | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.LoginPasswordlessEmailCode) | | ||
| | 7 | login-passwordless | login-passwordless-sms-otp | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.LoginPasswordlessSmsOtp) | | ||
| | 8 | passkeys | passkey-enrollment | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.PasskeyEnrollment) | | ||
| | 9 | passkeys | passkey-enrollment-local | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.PasskeyEnrollmentLocal) | | ||
| | 10 | phone-identifier-enrollment | phone-identifier-enrollment | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.PhoneIdentifierEnrollment) | | ||
| | 11 | phone-identifier-challenge | phone-identifier-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.PhoneIdentifierChallenge) | | ||
| | 12 | email-identifier-challenge | email-identifier-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.EmailIdentifierChallenge) | | ||
| | 13 | captcha | interstitial-captcha | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.InterstitialCaptcha) | | ||
| | 14 | reset-password | reset-password-email | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordEmail) | | ||
| | 15 | reset-password | reset-password-request | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordRequest) | | ||
| | 16 | reset-password | reset-password | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPassword) | | ||
| | 17 | reset-password | reset-password-error | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordError) | | ||
| | 18 | reset-password | reset-password-success | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordSuccess) | | ||
| | 19 | signup | signup | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.Signup) | | ||
| | 20 | mfa | mfa-detect-browser-capabilities | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaDetectBrowserCapabilities) | | ||
| | 21 | mfa | mfa-enroll-result | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaEnrollResult) | | ||
| | 22 | mfa | mfa-begin-enroll-options | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaBeginEnrollOptions) | | ||
| | 23 | mfa | mfa-login-options | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaLoginOptions) | | ||
| | 24 | mfa-push | mfa-push-enrollment-qr | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaPushEnrollmentQr) | | ||
| | 25 | mfa-push | mfa-push-welcome | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaPushWelcome) | | ||
| | 26 | mfa-push | mfa-push-challenge-push | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaPushChallengePush) | | ||
| | 27 | mfa-push | mfa-push-list | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaPushList) | | ||
| | 28 | mfa-sms | mfa-country-codes | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaCountryCodes) | | ||
| | 29 | mfa-sms | mfa-sms-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaSmsChallenge) | | ||
| | 30 | mfa-sms | mfa-sms-enrollment | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaSmsEnrollment) | | ||
| | 31 | mfa-sms | mfa-sms-list | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaSmsList) | | ||
| | 32 | mfa-email | mfa-email-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaEmailChallenge) | | ||
| | 33 | mfa-email | mfa-email-list | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaEmailList) | | ||
| | 34 | invitatino | accept-invitation | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.AcceptInvitation) | | ||
| | 35 | organizations | organization-picker | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.OrganizationPicker) | | ||
| | 36 | organizations | organization-selection | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.OrganizationSelection) | | ||
| | 37 | reset-password | mfa-otp-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaOtpChallenge) | | ||
| | 38 | mfa-otp | mfa-otp-enrollment-code | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaOtpEnrollmentCode) | | ||
| | 39 | mfa-otp | mfa-otp-enrollment-qr | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaOtpEnrollmentQr) | | ||
| | 40 | reset-password | reset-password-mfa-email-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordMfaEmailChallenge) | | ||
| | 41 | reset-password | reset-password-mfa-push-challenge-push | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordMfaPushChallengePush)| | ||
| | 42 | reset-password | mfa-sms-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordMfaSmsChallenge) | | ||
| | 43 | reset-password | reset-password-mfa-otp-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.OrganizationSelection) | | ||
| | 44 | mfa-phone | mfa-phone-enrollment | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaPhoneEnrollment) | | ||
| | 45 | mfa-voice | mfa-voice-enrollment | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaVoiceEnrollment) | | ||
| | 46 | mfa-recovery-code | mfa-recovery-code-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaRecoveryCodeChallenge) | | ||
| | 47 | device-flow | device-code-activation-allowed | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.DeviceCodeActivationAllowed) | | ||
| | 48 | device-flow | device-code-activation-denied | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.DeviceCodeActivationDenied) | | ||
| | 49 | device-flow | device-code-activation | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.DeviceCodeActivation) | | ||
| | 50 | reset-password | reset-password-mfa-recovery-code-challenge | [Link](https://auth0.github.io/universallogin/classes/Classes.ResetPasswordMfaRecoveryCodeChallenge) | | ||
| | 51 | reset-password | reset-password-mfa-voice | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordMfaVoiceChallenge) | | ||
| | 52 | common | redeem-ticket | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.RedeemTicket) | | ||
| | 53 | device-flow | device-code-confirmation | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.DeviceCodeConfirmation) | | ||
| | 54 | mfa-phone | mfa-phone-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaPhoneChallenge) | | ||
| | 55 | mfa-voice | mfa-voice-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaVoiceChallenge) | | ||
| | 56 | mfa-recovery-code | mfa-recovery-code-enrollment | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaRecoveryCodeEnrollment) | | ||
| | 57 | reset-password | reset-password-mfa-phone-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordMfaPhoneChallenge) | | ||
| | 58 | mfa-recovery-code | mfa-recovery-code-challenge-new-code | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaRecoveryCodeChallengeNewCode) | | ||
| | 59 | logout | logout | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.Logout) | | ||
| | 60 | logout | logout-aborted | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.LogoutAborted) | | ||
| | 61 | logout | logout-complete | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.LogoutComplete) | | ||
| | 62 | email-verification | email-verification-result | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.EmailVerificationResult) | | ||
| | 63 | login-email-verification | login-email-verification | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.LoginEmailVerification) | | ||
| | 64 |mfa-webauthn | mfa-webauthn-platform-enrollment | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaWebAuthnPlatformEnrollment) | | ||
| | 65 |mfa-webauthn | mfa-webauthn-error | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaWebAuthnError) | | ||
| | 66 |mfa-webauthn | mfa-webauthn-roaming-enrollment | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaWebAuthnRoamingEnrollment) | | ||
| | 67 |mfa-webauthn | mfa-webauthn-roaming-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaWebAuthnRoamingChallenge) | | ||
| | 68 |mfa-webauthn | mfa-webauthn-platform-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaWebAuthnPlatformChallenge) | | ||
| | 69 |mfa-webauthn | mfa-webauthn-enrollment-success | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaWebAuthnEnrollmentSuccess) | | ||
| | 70 |mfa-webauthn | mfa-webauthn-change-key-nickname | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaWebAuthnChangeKeyNickname) | | ||
| | 71 |mfa-webauthn | mfa-webauthn-not-available-error | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.MfaWebAuthnNotAvailableError) | | ||
| | 72 |reset-password | reset-password-mfa-webauthn-platform-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordMfaWebAuthnPlatformChallenge) | | ||
| | 73 |reset-password | reset-password-mfa-webauthn-roaming-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.ResetPasswordMfaWebAuthnRoamingChallenge) | | ||
| | 74 |consent | consent | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.consent) | | ||
| | 75 |customized-consent | customized-consent | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.CustomizedConsent) | | ||
| | 76 |email-otp-challenge | email-otp-challenge | [Link](https://acul-docs.netlify.app/auth0-acul-react/modules/Screens.EmailOTPChallenge) | | ||
| </details> | ||
| --- | ||
| ## Hooks | ||
| ### Context Hooks (Available in all screens) | ||
| - `useUser()` - Current user information | ||
| - `useTenant()` - Tenant configuration | ||
| - `useClient()` - Application client information | ||
| - `useScreen()` - Current screen data and configuration | ||
| - `useTransaction()` - Transaction state and methods | ||
| - `useBranding()` - Tenant branding and theme | ||
| - `useOrganization()` - Organization context (if applicable) | ||
| - `usePrompt()` - Current authentication prompt | ||
| - `useUntrustedData()` - Untrusted data from the authentication flow | ||
| ### Utility Hooks | ||
| Specialized hooks for form validation, polling, and identifier management: | ||
| #### Identifier Management | ||
| - `useLoginIdentifiers()` - Get available login identifier types (email, phone, username) | ||
| - `useSignupIdentifiers()` - Get available signup identifier types, each with its `required` status | ||
| #### Form Validation | ||
| - `usePasswordValidation(password, rules)` - Real-time password strength validation | ||
| - `useUsernameValidation(username)` - Username format and availability validation | ||
| #### MFA & Polling | ||
| - `useMfaPolling(options)` - Manage MFA push notification polling lifecycle | ||
| - `useResend(options)` - Handle resend operations with cooldown timers | ||
| ### Common Hooks | ||
| General-purpose hooks available across all screens: | ||
| #### Screen Management | ||
| - `useCurrentScreen()` - Get complete current screen context data | ||
| - `useAuth0Themes()` - Access tenant branding and theme configuration | ||
| #### Error Handling | ||
| - `useErrors(options)` - Comprehensive error management with categorization | ||
| - Filter by error kind: `'validation'`, `'auth0'`, `'configuration'` | ||
| - Filter by field name for form-specific errors | ||
| - Dismiss individual or all errors | ||
| ### Screen-Specific Action Methods | ||
| Each screen module exports methods for screen actions: | ||
| ```tsx | ||
| // Login ID Screen | ||
| import { | ||
| loginMethod, | ||
| continueWithFederatedLogin | ||
| } from '@auth0/auth0-acul-react/login-id'; | ||
| // Password Screen | ||
| import { | ||
| loginMethod, | ||
| forgotPasswordMethod | ||
| } from '@auth0/auth0-acul-react/login-password'; | ||
| // MFA Push Challenge | ||
| import { | ||
| continueMethod, | ||
| resendPushNotification, | ||
| useMfaPolling | ||
| } from '@auth0/auth0-acul-react/mfa-push-challenge-push'; | ||
| ``` | ||
| ## Examples | ||
| Check out the [`examples/`](https://github.com/auth0/universal-login/tree/main/packages/auth0-acul-react/examples) directory for complete, working examples of how to use this SDK to build custom Universal Login screens. | ||
| - [React Examples](https://github.com/auth0/universal-login/tree/master/packages/auth0-acul-react/examples) - Complete React component examples | ||
| - [React Boilerplate](https://github.com/auth0/auth0-acul-react-boilerplate) - Full React application template | ||
| --- | ||
| <a id="feedback"></a> | ||
| ## π¬ Feedback | ||
| ### Contributing | ||
| We appreciate feedback and contribution to this repo! Before you get started, please see the following: | ||
| - [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md) | ||
| - [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md) | ||
| ### Raise an issue | ||
| To provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/auth0/universal-login/issues). | ||
| ### Vulnerability Reporting | ||
| Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/responsible-disclosure-policy) details the procedure for disclosing security issues. | ||
| ### Legal | ||
| **Early Access.** This SDK and its associated product are made available only in Early Access ("EA") format and are governed by the Free Trial terms of the [Okta Master Subscription Agreement](https://www.okta.com/agreements/#mastersubscriptionagreement). If Okta elects to make a version of this SDK and its associated product Generally Available ("GA"), such GA version may have different pricing, product and feature configurations, and use of the GA product and SDK will be subject to the standard terms of the Agreement (or other such titled written or electronic agreement addressing the same subject matter) between Okta and Customer." | ||
| --- | ||
| <p align="center"> | ||
@@ -124,0 +327,0 @@ <picture> |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
501768
6.59%282
1.08%2392
4.41%330
159.84%86
1.18%+ Added
- Removed