import DeviceM from "./DeviceM";
import TgM from "./TgM";

export default class PayM {
  share(shareLink: string) {
    throw new Error("Method not implemented.");
  }

  private static _ins: PayM;
  public static get ins(): PayM {
    return (PayM._ins ??= new PayM());
  }

  public async jumpToPay(url: string) {
    console.log("jumpToPay...url:", url);
    if (url) {
      url = url.trim();
      if (await TgM.ins.isTG()) {
        TgM.ins.openTelegramLink(url);

        // TGOpenLink(url);
      } else {
        console.log("web jump:", url);

        if (DeviceM.ins.isMobile()) {
          window.location.href = url;
        } else {
          window.open(url, "_blank");

        }
      }
    }
  }
}
