@frak-labs/components
Version:
Frak Wallet components, helping any person to interact with the Frak wallet.
1 lines • 960 B
JavaScript
import{_ as e,b as t,g as n,m as r}from"./loader.js";import{d as i,i as a,o,t as s,u as c}from"./usePlacement.BgMXY5CX.js";import{t as l}from"./useLightDomStyles.tjNBKcOr.js";function u(r=`wallet`,i){let a=window.FrakSetup?.client;a&&t(a,`open_in_app_clicked`,{path:r,placement:i}),n(`${e}${r}`,{onFallback:()=>{a&&t(a,`app_not_installed`,{path:r,placement:i})}})}function d(){return{isMobile:o(()=>r(),[])}}function f({placement:e,text:t=`Open in App`,classname:n=``}){let r=s(e),{shouldRender:i,isHidden:o,isClientReady:f}=a(),{isMobile:p}=d();l(`frak-open-in-app`,e,r?.components?.openInApp?.css);let m=r?.components?.openInApp?.text??t;if(!p||!i||o)return null;let h=()=>{u(void 0,e)},g=[`button`,`button__fadeIn`,n].filter(Boolean).join(` `);return c(`button`,{type:`button`,"aria-label":`Open in Frak Wallet app`,disabled:!f,class:g,onClick:h,children:m})}i(f,`frak-open-in-app`,[`text`,`placement`,`classname`],{shadow:!1});export{f as OpenInAppButton};