import {
AlertCircleIcon,
AlertTriangleIcon,
CopyIcon,
ExternalLinkIcon,
MonitorIcon,
RadioIcon,
SmartphoneIcon,
TriangleAlertIcon,
UserIcon,
ZapIcon,
} from "lucide-react";
import React from "react";
import { useLocation, useNavigate } from "react-router";
import AppHeader from "src/components/AppHeader";
import ExternalLink from "src/components/ExternalLink";
import { FormattedBitcoinAmount } from "src/components/FormattedBitcoinAmount";
import { AppleIcon } from "src/components/icons/Apple";
import { PlayStoreIcon } from "src/components/icons/PlayStore";
import { ZapStoreIcon } from "src/components/icons/ZapStore";
import { IsolatedAppTopupDialog } from "src/components/IsolatedAppTopupDialog";
import QRCode from "src/components/QRCode";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "src/components/ui/accordion";
import { Alert, AlertDescription, AlertTitle } from "src/components/ui/alert";
import { Button } from "src/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "src/components/ui/card";
import { ExternalLinkButton } from "src/components/ui/custom/external-link-button";
import { InputWithAdornment } from "src/components/ui/custom/input-with-adornment";
import { LinkButton } from "src/components/ui/custom/link-button";
import { LoadingButton } from "src/components/ui/custom/loading-button";
import { Input } from "src/components/ui/input";
import { Label } from "src/components/ui/label";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "src/components/ui/popover";
import { Textarea } from "src/components/ui/textarea";
import { UpgradeDialog } from "src/components/UpgradeDialog";
import { useAlbyMe } from "src/hooks/useAlbyMe";
import { useApp } from "src/hooks/useApp";
import { useCreateLightningAddress } from "src/hooks/useCreateLightningAddress";
import { useNodeConnectionInfo } from "src/hooks/useNodeConnectionInfo";
import { copyToClipboard } from "src/lib/clipboard";
import { ConnectAppCard } from "src/screens/apps/ConnectAppCard";
import { CreateAppResponse } from "src/types";
export function SubwalletCreated() {
const { data: nodeConnectionInfo } = useNodeConnectionInfo();
const { state } = useLocation();
const navigate = useNavigate();
const createAppResponse = state as CreateAppResponse | undefined;
const { data: app } = useApp(createAppResponse?.id, true);
const [intendedLightningAddress, setIntendedLightningAddress] =
React.useState(
createAppResponse?.name
.toLowerCase()
.trim()
.replace(/\s+/g, "_")
.replace(/[^a-z0-9_]/g, "") || ""
);
const { data: albyMe } = useAlbyMe();
const { createLightningAddress, creatingLightningAddress } =
useCreateLightningAddress(createAppResponse?.id);
const [step, setStep] = React.useState(1);
if (!createAppResponse?.pairingUri) {
navigate("/");
return null;
}
const name = createAppResponse.name;
let connectionSecret = createAppResponse.pairingUri;
if (app?.metadata?.lud16) {
connectionSecret += `&lud16=${app.metadata.lud16}`;
}
const albyAccountUrl = `https://getalby.com/nwc/new#${connectionSecret}`;
const valueTag = `
{app.metadata.lud16}
To allow receiving podcasting 2.0 payments to the sub-wallet, make sure to share the podcast:value tag that needs to be added to recipient's RSS feed: