@spicenet-io/spiceflow-ui 3.3.55 → 3.3.56
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/auth-dynamic.cjs.js +1 -1
- package/dist/auth-dynamic.js +1 -1
- package/dist/index.cjs.js +8 -8
- package/dist/index.js +8 -8
- package/package.json +1 -1
package/dist/auth-dynamic.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),c=require("react"),t=require("./Button-D2a1fJxH.js"),
|
|
2
|
+
"use strict";const e=require("react/jsx-runtime"),c=require("react"),t=require("./Button-D2a1fJxH.js"),k=require("@dynamic-labs/sdk-react-core");require("@spicenet-io/spiceflow-core"),require("viem"),require("viem/actions"),require("@tanstack/react-query"),require("@privy-io/react-auth"),require("wagmi");const L=({onAuthSuccess:a,onAuthError:r,theme:h="light",className:i="",buttonText:o="Login with Dynamic",autoTrigger:l=!1})=>{const s=t.createTheme(h),[m,D]=c.useState(!1),[g,S]=c.useState(!1),w=k.useDynamicContext(),{user:E,primaryWallet:f,connectedWallets:b,handleLogOut:q,setShowAuthFlow:x,sdkHasLoaded:p,showAuthFlow:j}=w,n=(t.getDynamicEmbeddedWallet({connectedWallets:b,primaryWallet:f})||f)?.address,v=!!E,d=v&&!!n;c.useEffect(()=>{D(!0)},[]),c.useEffect(()=>{d&&n&&a&&a(n)},[d,n,a]),c.useEffect(()=>{l&&p&&m&&!d&&!j&&!g&&(S(!0),x(!0))},[l,p,m,d,j,g,x]);const C=()=>{try{x(!0)}catch(y){const u=`Dynamic login failed: ${String(y)}`;r?r(u):console.error(u)}},N=async()=>{try{await q()}catch(y){const u=`Dynamic logout failed: ${String(y)}`;r?r(u):console.error(u)}};return m?p?v&&!n?e.jsx("div",{className:i,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e.jsx(t.Spinner,{size:40,borderWidth:3,color:s.colors.primary}),e.jsx("p",{style:{color:s.colors.textMuted,fontSize:"14px"},children:"Finishing wallet setup..."})]})}):d&&n?e.jsx("div",{className:i,children:e.jsxs(t.Button,{variant:"primary",onClick:N,theme:s,children:["Logout (",n.slice(0,6),"...",n.slice(-4),")"]})}):l?e.jsx("div",{className:i,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e.jsx(t.Spinner,{size:40,borderWidth:3,color:s.colors.primary}),e.jsx("p",{style:{color:s.colors.textMuted,fontSize:"14px"},children:"Opening login..."})]})}):e.jsx("div",{className:i,children:e.jsx(t.Button,{variant:"primary",onClick:C,theme:s,children:o})}):e.jsx("div",{className:i,children:e.jsx(t.Button,{variant:"primary",disabled:!0,theme:s,children:"Loading..."})}):e.jsx("div",{className:i,children:e.jsx(t.Button,{variant:"primary",disabled:!0,theme:s,children:o})})};class W extends c.Component{constructor(r){super(r),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback:this.props.children}}const B=a=>{const{theme:r="light",className:h="",buttonText:i="Login with Dynamic",onAuthError:o}=a,l=t.createTheme(r);return e.jsx(W,{fallback:e.jsx("div",{className:h,children:e.jsx(t.Button,{variant:"primary",onClick:()=>{o&&o('DynamicLogin must be used within SpiceFlowProvider provider="dynamic" and a mounted DynamicContextProvider.')},theme:l,children:i})}),children:e.jsx(L,{...a})})};exports.DynamicLogin=B;
|
package/dist/auth-dynamic.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as g}from"react/jsx-runtime";import A,{useState as N,useEffect as f}from"react";import{B as d,c as S,g as j,S as b}from"./Button-CBKXr9p2.js";import{useDynamicContext as z}from"@dynamic-labs/sdk-react-core";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";import"@tanstack/react-query";import"@privy-io/react-auth";import"wagmi";const M=({onAuthSuccess:a,onAuthError:t,theme:m="light",className:r="",buttonText:o="Login with Dynamic",autoTrigger:s=!1})=>{const i=S(m),[h,C]=N(!1),[x,E]=N(!1),
|
|
2
|
+
import{jsx as e,jsxs as g}from"react/jsx-runtime";import A,{useState as N,useEffect as f}from"react";import{B as d,c as S,g as j,S as b}from"./Button-CBKXr9p2.js";import{useDynamicContext as z}from"@dynamic-labs/sdk-react-core";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";import"@tanstack/react-query";import"@privy-io/react-auth";import"wagmi";const M=({onAuthSuccess:a,onAuthError:t,theme:m="light",className:r="",buttonText:o="Login with Dynamic",autoTrigger:s=!1})=>{const i=S(m),[h,C]=N(!1),[x,E]=N(!1),k=z(),{user:L,primaryWallet:v,connectedWallets:W,handleLogOut:F,setShowAuthFlow:p,sdkHasLoaded:u,showAuthFlow:D}=k,n=(j({connectedWallets:W,primaryWallet:v})||v)?.address,w=!!L,l=w&&!!n;return f(()=>{C(!0)},[]),f(()=>{l&&n&&a&&a(n)},[l,n,a]),f(()=>{s&&u&&h&&!l&&!D&&!x&&(E(!0),p(!0))},[s,u,h,l,D,x,p]),h?u?w&&!n?e("div",{className:r,children:g("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e(b,{size:40,borderWidth:3,color:i.colors.primary}),e("p",{style:{color:i.colors.textMuted,fontSize:"14px"},children:"Finishing wallet setup..."})]})}):l&&n?e("div",{className:r,children:g(d,{variant:"primary",onClick:async()=>{try{await F()}catch(y){const c=`Dynamic logout failed: ${String(y)}`;t?t(c):console.error(c)}},theme:i,children:["Logout (",n.slice(0,6),"...",n.slice(-4),")"]})}):s?e("div",{className:r,children:g("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e(b,{size:40,borderWidth:3,color:i.colors.primary}),e("p",{style:{color:i.colors.textMuted,fontSize:"14px"},children:"Opening login..."})]})}):e("div",{className:r,children:e(d,{variant:"primary",onClick:()=>{try{p(!0)}catch(y){const c=`Dynamic login failed: ${String(y)}`;t?t(c):console.error(c)}},theme:i,children:o})}):e("div",{className:r,children:e(d,{variant:"primary",disabled:!0,theme:i,children:"Loading..."})}):e("div",{className:r,children:e(d,{variant:"primary",disabled:!0,theme:i,children:o})})};class T extends A.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback:this.props.children}}const B=a=>{const{theme:t="light",className:m="",buttonText:r="Login with Dynamic",onAuthError:o}=a,s=S(t);return e(T,{fallback:e("div",{className:m,children:e(d,{variant:"primary",onClick:()=>{o&&o('DynamicLogin must be used within SpiceFlowProvider provider="dynamic" and a mounted DynamicContextProvider.')},theme:s,children:r})}),children:e(M,{...a})})};export{B as DynamicLogin};
|