import {generatePeraWalletConnectDeepLink} from "../../../util/peraWalletUtils"; import styles from "./_pera-wallet-modal-touch-screen-mode.scss"; const peraWalletModalTouchScreenMode = document.createElement("template"); const touchScreenDefaultMode = `
Launch Pera Wallet

New to Pera?

Install Pera Wallet
`; export class PeraWalletModalTouchScreenMode extends HTMLElement { constructor() { super(); this.attachShadow({mode: "open"}); peraWalletModalTouchScreenMode.innerHTML = touchScreenDefaultMode; if (this.shadowRoot) { const styleSheet = document.createElement("style"); styleSheet.textContent = styles; this.shadowRoot.append( peraWalletModalTouchScreenMode.content.cloneNode(true), styleSheet ); const launchPeraLink = this.shadowRoot?.getElementById( "pera-wallet-connect-modal-touch-screen-mode-launch-pera-wallet-button" ); const URI = this.getAttribute("uri"); const singleAccount = this.getAttribute("single-account") === "true"; const selectedAccount = this.getAttribute("selected-account") || undefined; if (launchPeraLink && URI) { launchPeraLink.setAttribute("href", generatePeraWalletConnectDeepLink(URI, {singleAccount, selectedAccount})); launchPeraLink.addEventListener("click", () => { this.onClickLaunch(); }); } } } onClickLaunch() { peraWalletModalTouchScreenMode.innerHTML = `
`; if (this.shadowRoot) { const styleSheet = document.createElement("style"); styleSheet.textContent = styles; this.shadowRoot.innerHTML = ""; this.shadowRoot.append( peraWalletModalTouchScreenMode.content.cloneNode(true), styleSheet ); } } }