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