@trymellon/js 1.5.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular.cjs +1 -1
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.js +1 -1
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +2 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var c=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},E=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of d(t))!x.call(e,o)&&o!==r&&c(e,o,{get:()=>t[o],enumerable:!(n=A(t,o))||n.enumerable});return e};var S=e=>E(c({},"__esModule",{value:!0}),e);var O={};h(O,{TryMellonProvider:()=>y,useAuthenticate:()=>f,useRegister:()=>R,useTryMellon:()=>l});module.exports=S(O);var i=require("react"),m=require("react/jsx-runtime"),a=(0,i.createContext)(null);function y(e){return(0,m.jsx)(a.Provider,{value:e.client,children:e.children})}function l(){let e=(0,i.useContext)(a);if(e==null)throw new Error("useTryMellon must be used within TryMellonProvider");return e}var T=require("react");var u=require("react");function p(e){let[t,r]=(0,u.useState)({result:null,loading:!1,error:null}),n=(0,u.useCallback)(async o=>{r(g=>({...g,loading:!0,error:null,result:null}));let s=await e(o);return r({result:s,loading:!1,error:s.ok?null:s.error}),s},[e]);return{result:t.result,loading:t.loading,error:t.error,execute:n}}function R(){let e=l(),t=(0,T.useCallback)(r=>e.register(r),[e]);return p(t)}var M=require("react");function f(){let e=l(),t=(0,M.useCallback)(r=>e.authenticate(r),[e]);return p(t)}
|
|
3
3
|
//# sourceMappingURL=react.cjs.map
|
package/dist/react.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/index.ts","../src/react/context.tsx","../src/react/use-register.tsx","../src/react/use-authenticate.tsx"],"sourcesContent":["export { TryMellonProvider, useTryMellon } from './context';\nexport { useRegister } from './use-register';\nexport { useAuthenticate } from './use-authenticate';\n","import { createContext, useContext, type ReactNode } from 'react';\nimport type { TryMellon } from '../core/trymellon';\n\nconst TryMellonContext = createContext<TryMellon | null>(null);\n\nexport function TryMellonProvider(props: { client: TryMellon; children: ReactNode }) {\n return (\n <TryMellonContext.Provider value={props.client}>{props.children}</TryMellonContext.Provider>\n );\n}\n\nexport function useTryMellon(): TryMellon {\n const client = useContext(TryMellonContext);\n if (client == null) {\n throw new Error('useTryMellon must be used within TryMellonProvider');\n }\n return client;\n}\n","import {
|
|
1
|
+
{"version":3,"sources":["../src/react/index.ts","../src/react/context.tsx","../src/react/use-register.tsx","../src/react/use-action.ts","../src/react/use-authenticate.tsx"],"sourcesContent":["export { TryMellonProvider, useTryMellon } from './context';\nexport { useRegister } from './use-register';\nexport { useAuthenticate } from './use-authenticate';\n","import { createContext, useContext, type ReactNode } from 'react';\nimport type { TryMellon } from '../core/trymellon';\n\nconst TryMellonContext = createContext<TryMellon | null>(null);\n\nexport function TryMellonProvider(props: { client: TryMellon; children: ReactNode }) {\n return (\n <TryMellonContext.Provider value={props.client}>{props.children}</TryMellonContext.Provider>\n );\n}\n\nexport function useTryMellon(): TryMellon {\n const client = useContext(TryMellonContext);\n if (client == null) {\n throw new Error('useTryMellon must be used within TryMellonProvider');\n }\n return client;\n}\n","import { useCallback } from 'react';\nimport { useTryMellon } from './context';\nimport { useTryMellonAction, type UseActionState } from './use-action';\nimport type { RegisterOptions, RegisterResult } from '../types';\nimport type { TryMellonError } from '../errors';\nimport type { Result } from '../utils/result';\n\nexport type UseRegisterState = UseActionState<RegisterResult>;\n\nexport function useRegister(): {\n result: Result<RegisterResult, TryMellonError> | null;\n loading: boolean;\n error: TryMellonError | null;\n execute: (options: RegisterOptions) => Promise<Result<RegisterResult, TryMellonError>>;\n} {\n const client = useTryMellon();\n const action = useCallback((options: RegisterOptions) => client.register(options), [client]);\n return useTryMellonAction(action);\n}\n","import { useState, useCallback } from 'react';\nimport type { TryMellonError } from '../errors';\nimport type { Result } from '../utils/result';\n\nexport type UseActionState<TResult> = {\n result: Result<TResult, TryMellonError> | null;\n loading: boolean;\n error: TryMellonError | null;\n};\n\nexport function useTryMellonAction<TOptions, TResult>(\n action: (options: TOptions) => Promise<Result<TResult, TryMellonError>>\n) {\n const [state, setState] = useState<UseActionState<TResult>>({\n result: null,\n loading: false,\n error: null,\n });\n\n const execute = useCallback(\n async (options: TOptions) => {\n setState((s) => ({ ...s, loading: true, error: null, result: null }));\n const result = await action(options);\n setState({\n result,\n loading: false,\n error: result.ok ? null : result.error,\n });\n return result;\n },\n [action]\n );\n\n return {\n result: state.result,\n loading: state.loading,\n error: state.error,\n execute,\n };\n}\n","import { useCallback } from 'react';\nimport { useTryMellon } from './context';\nimport { useTryMellonAction, type UseActionState } from './use-action';\nimport type { AuthenticateOptions, AuthenticateResult } from '../types';\nimport type { TryMellonError } from '../errors';\nimport type { Result } from '../utils/result';\n\nexport type UseAuthenticateState = UseActionState<AuthenticateResult>;\n\nexport function useAuthenticate(): {\n result: Result<AuthenticateResult, TryMellonError> | null;\n loading: boolean;\n error: TryMellonError | null;\n execute: (options: AuthenticateOptions) => Promise<Result<AuthenticateResult, TryMellonError>>;\n} {\n const client = useTryMellon();\n const action = useCallback(\n (options: AuthenticateOptions) => client.authenticate(options),\n [client]\n );\n return useTryMellonAction(action);\n}\n"],"mappings":";yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,E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vider","useAuthenticate","useRegister","useTryMellon","__toCommonJS","import_react","import_jsx_runtime","TryMellonContext","TryMellonProvider","props","useTryMellon","client","import_react","import_react","useTryMellonAction","action","state","setState","execute","options","s","result","useRegister","client","useTryMellon","action","options","useTryMellonAction","import_react","useAuthenticate","client","useTryMellon","action","options","useTryMellonAction"]}
|
package/dist/react.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{createContext as
|
|
2
|
+
import{createContext as c,useContext as a}from"react";import{jsx as m}from"react/jsx-runtime";var s=c(null);function y(e){return m(s.Provider,{value:e.client,children:e.children})}function o(){let e=a(s);if(e==null)throw new Error("useTryMellon must be used within TryMellonProvider");return e}import{useCallback as M}from"react";import{useState as T,useCallback as R}from"react";function n(e){let[t,r]=T({result:null,loading:!1,error:null}),i=R(async u=>{r(p=>({...p,loading:!0,error:null,result:null}));let l=await e(u);return r({result:l,loading:!1,error:l.ok?null:l.error}),l},[e]);return{result:t.result,loading:t.loading,error:t.error,execute:i}}function f(){let e=o(),t=M(r=>e.register(r),[e]);return n(t)}import{useCallback as g}from"react";function A(){let e=o(),t=g(r=>e.authenticate(r),[e]);return n(t)}export{y as TryMellonProvider,A as useAuthenticate,f as useRegister,o as useTryMellon};
|
|
3
3
|
//# sourceMappingURL=react.js.map
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/context.tsx","../src/react/use-register.tsx","../src/react/use-authenticate.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from 'react';\nimport type { TryMellon } from '../core/trymellon';\n\nconst TryMellonContext = createContext<TryMellon | null>(null);\n\nexport function TryMellonProvider(props: { client: TryMellon; children: ReactNode }) {\n return (\n <TryMellonContext.Provider value={props.client}>{props.children}</TryMellonContext.Provider>\n );\n}\n\nexport function useTryMellon(): TryMellon {\n const client = useContext(TryMellonContext);\n if (client == null) {\n throw new Error('useTryMellon must be used within TryMellonProvider');\n }\n return client;\n}\n","import {
|
|
1
|
+
{"version":3,"sources":["../src/react/context.tsx","../src/react/use-register.tsx","../src/react/use-action.ts","../src/react/use-authenticate.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from 'react';\nimport type { TryMellon } from '../core/trymellon';\n\nconst TryMellonContext = createContext<TryMellon | null>(null);\n\nexport function TryMellonProvider(props: { client: TryMellon; children: ReactNode }) {\n return (\n <TryMellonContext.Provider value={props.client}>{props.children}</TryMellonContext.Provider>\n );\n}\n\nexport function useTryMellon(): TryMellon {\n const client = useContext(TryMellonContext);\n if (client == null) {\n throw new Error('useTryMellon must be used within TryMellonProvider');\n }\n return client;\n}\n","import { useCallback } from 'react';\nimport { useTryMellon } from './context';\nimport { useTryMellonAction, type UseActionState } from './use-action';\nimport type { RegisterOptions, RegisterResult } from '../types';\nimport type { TryMellonError } from '../errors';\nimport type { Result } from '../utils/result';\n\nexport type UseRegisterState = UseActionState<RegisterResult>;\n\nexport function useRegister(): {\n result: Result<RegisterResult, TryMellonError> | null;\n loading: boolean;\n error: TryMellonError | null;\n execute: (options: RegisterOptions) => Promise<Result<RegisterResult, TryMellonError>>;\n} {\n const client = useTryMellon();\n const action = useCallback((options: RegisterOptions) => client.register(options), [client]);\n return useTryMellonAction(action);\n}\n","import { useState, useCallback } from 'react';\nimport type { TryMellonError } from '../errors';\nimport type { Result } from '../utils/result';\n\nexport type UseActionState<TResult> = {\n result: Result<TResult, TryMellonError> | null;\n loading: boolean;\n error: TryMellonError | null;\n};\n\nexport function useTryMellonAction<TOptions, TResult>(\n action: (options: TOptions) => Promise<Result<TResult, TryMellonError>>\n) {\n const [state, setState] = useState<UseActionState<TResult>>({\n result: null,\n loading: false,\n error: null,\n });\n\n const execute = useCallback(\n async (options: TOptions) => {\n setState((s) => ({ ...s, loading: true, error: null, result: null }));\n const result = await action(options);\n setState({\n result,\n loading: false,\n error: result.ok ? null : result.error,\n });\n return result;\n },\n [action]\n );\n\n return {\n result: state.result,\n loading: state.loading,\n error: state.error,\n execute,\n };\n}\n","import { useCallback } from 'react';\nimport { useTryMellon } from './context';\nimport { useTryMellonAction, type UseActionState } from './use-action';\nimport type { AuthenticateOptions, AuthenticateResult } from '../types';\nimport type { TryMellonError } from '../errors';\nimport type { Result } from '../utils/result';\n\nexport type UseAuthenticateState = UseActionState<AuthenticateResult>;\n\nexport function useAuthenticate(): {\n result: Result<AuthenticateResult, TryMellonError> | null;\n loading: boolean;\n error: TryMellonError | null;\n execute: (options: AuthenticateOptions) => Promise<Result<AuthenticateResult, TryMellonError>>;\n} {\n const client = useTryMellon();\n const action = useCallback(\n (options: AuthenticateOptions) => client.authenticate(options),\n [client]\n );\n return useTryMellonAction(action);\n}\n"],"mappings":";AAAA,OAAS,iBAAAA,EAAe,cAAAC,MAAkC,QAOtD,cAAAC,MAAA,oBAJJ,IAAMC,EAAmBH,EAAgC,IAAI,EAEtD,SAASI,EAAkBC,EAAmD,CACnF,OACEH,EAACC,EAAiB,SAAjB,CAA0B,MAAOE,EAAM,OAAS,SAAAA,EAAM,SAAS,CAEpE,CAEO,SAASC,GAA0B,CACxC,IAAMC,EAASN,EAAWE,CAAgB,EAC1C,GAAII,GAAU,KACZ,MAAM,IAAI,MAAM,oDAAoD,EAEtE,OAAOA,CACT,CCjBA,OAAS,eAAAC,MAAmB,QCA5B,OAAS,YAAAC,EAAU,eAAAC,MAAmB,QAU/B,SAASC,EACdC,EACA,CACA,GAAM,CAACC,EAAOC,CAAQ,EAAIL,EAAkC,CAC1D,OAAQ,KACR,QAAS,GACT,MAAO,IACT,CAAC,EAEKM,EAAUL,EACd,MAAOM,GAAsB,CAC3BF,EAAUG,IAAO,CAAE,GAAGA,EAAG,QAAS,GAAM,MAAO,KAAM,OAAQ,IAAK,EAAE,EACpE,IAAMC,EAAS,MAAMN,EAAOI,CAAO,EACnC,OAAAF,EAAS,CACP,OAAAI,EACA,QAAS,GACT,MAAOA,EAAO,GAAK,KAAOA,EAAO,KACnC,CAAC,EACMA,CACT,EACA,CAACN,CAAM,CACT,EAEA,MAAO,CACL,OAAQC,EAAM,OACd,QAASA,EAAM,QACf,MAAOA,EAAM,MACb,QAAAE,CACF,CACF,CD9BO,SAASI,GAKd,CACA,IAAMC,EAASC,EAAa,EACtBC,EAASC,EAAaC,GAA6BJ,EAAO,SAASI,CAAO,EAAG,CAACJ,CAAM,CAAC,EAC3F,OAAOK,EAAmBH,CAAM,CAClC,CElBA,OAAS,eAAAI,MAAmB,QASrB,SAASC,GAKd,CACA,IAAMC,EAASC,EAAa,EACtBC,EAASC,EACZC,GAAiCJ,EAAO,aAAaI,CAAO,EAC7D,CAACJ,CAAM,CACT,EACA,OAAOK,EAAmBH,CAAM,CAClC","names":["createContext","useContext","jsx","TryMellonContext","TryMellonProvider","props","useTryMellon","client","useCallback","useState","useCallback","useTryMellonAction","action","state","setState","execute","options","s","result","useRegister","client","useTryMellon","action","useCallback","options","useTryMellonAction","useCallback","useAuthenticate","client","useTryMellon","action","useCallback","options","useTryMellonAction"]}
|