import { ReactGA as t } from "@arcblock/ux/lib/withTracker";
import { GA_LAST_LOGIN_METHOD as n, GA_LAST_ROLE as l, GA_LAST_SOURCE_PROVIDER as i } from "@arcblock/ux/lib/withTracker/constant";
const S = () => {
  const e = {
    action: "loginSuccess",
    provider: localStorage.getItem(n),
    success: !0
  };
  t.event(e.action, e);
}, v = (e) => {
  const s = {
    action: "loginFailed",
    provider: localStorage.getItem(n),
    success: !1,
    errorMessage: e.message
  };
  t.event(s.action, s);
}, p = (e, s, o) => {
  const c = localStorage.getItem(l), r = o?.user?.role, a = {
    action: "switchPassportSuccess",
    change: `${c} -> ${r}`,
    success: !0
  };
  t.event(a.action, a);
}, m = (e) => {
  const s = {
    action: "switchPassportFailed",
    success: !1,
    errorMessage: e.message
  };
  t.event(s.action, s);
}, _ = (e, s, o) => {
  const c = {
    action: "bindWalletSuccess",
    provider: o?.user?.sourceProvider,
    success: !0
  };
  t.event(c.action, c);
}, E = (e) => {
  const s = {
    action: "bindWalletFailed",
    provider: localStorage.getItem(i),
    success: !1,
    errorMessage: e.message
  };
  t.event(s.action, s);
};
export {
  E as gaBindWalletFailedHandler,
  _ as gaBindWalletSuccessHandler,
  v as gaLoginFailedHandler,
  S as gaLoginSuccessHandler,
  m as gaSwitchPassportFailedHandler,
  p as gaSwitchPassportSuccessHandler
};
