import { Button as P } from "./accelbyte-widgets107.mjs";
import { Dialog as c, DialogBody as m, DialogFooter as i } from "./accelbyte-widgets235.mjs";
import { ArrowIcon as p, ArrowIconStyles as u } from "./accelbyte-widgets125.mjs";
import { Spinner as S, SpinnerStyle as C } from "./accelbyte-widgets154.mjs";
import { t as D } from "./accelbyte-widgets58.mjs";
import { ItemType as l } from "./accelbyte-widgets185.mjs";
import { AccPath as N } from "./accelbyte-widgets34.mjs";
import { GameHelper as O } from "./accelbyte-widgets205.mjs";
import { PurchaseHelper as x } from "./accelbyte-widgets211.mjs";
import f from "./accelbyte-widgets488.mjs";
import K from "./accelbyte-widgets489.mjs";
import w from "./accelbyte-widgets490.mjs";
import k from "./accelbyte-widgets491.mjs";
import a from "classnames";
import e from "react";
import { Trans as t } from "react-i18next";
import { Link as b } from "react-router-dom";
import "./accelbyte-widgets492.mjs";
class g extends e.Component {
  render() {
    const { className: n, isLoading: s, onClick: d } = this.props;
    return /* @__PURE__ */ e.createElement("button", { onClick: d, className: a("btn btnClose btn-ghost uppercase", n), disabled: s }, s && /* @__PURE__ */ e.createElement(S, { className: C.inline }), /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentSuccess.close" }, "CLOSE"));
  }
}
class J extends e.Component {
  constructor(n) {
    super(n), this.handleClose = () => {
      const { onCloseDialog: s } = this.props;
      s && s();
    }, this.state = {
      isLoading: !1
    };
  }
  async componentDidMount() {
    if (!this.props.isPreviewMode)
      try {
        this.setState({ isLoading: !0 }), await O.loadGameInfo();
      } finally {
        this.setState({ isLoading: !1 });
      }
  }
  render() {
    const { isLoading: n } = this.state, { orderInfo: s, isPreviewMode: d, isOnlyShowCloseButton: E } = this.props, y = `${s.currency.currencySymbol} ${x.calculateIntegerPrice(
      s.totalPrice || 0,
      s.currency
    )}`, h = s.itemSnapshot, r = h && h.itemType;
    return /* @__PURE__ */ e.createElement(
      c,
      {
        title: D("PaymentStatusDialog.paymentSuccess.title"),
        isOpen: !0,
        className: a("paymentStatusDialog", this.props.className, {
          orderCode: r === l.enum.CODE
        }),
        isPreviewMode: d
      },
      /* @__PURE__ */ e.createElement(m, { className: a("dialogBody", { nonCode: r !== l.enum.CODE }) }, /* @__PURE__ */ e.createElement("img", { src: k, alt: "Payment Success" }), r === l.enum.CODE ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.content.thanks" }, /* @__PURE__ */ e.createElement("p", { className: "code heading above" }, "Thank you! Your payment of ", /* @__PURE__ */ e.createElement("span", { className: "price" }, { price: y }), " was"), /* @__PURE__ */ e.createElement("p", { className: "code heading bottom" }, "successful.")), /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentSuccess.code.description" }, /* @__PURE__ */ e.createElement("p", { className: "description" }, "Your product key has been sent to your email. You can also see"), /* @__PURE__ */ e.createElement("p", { className: "description code bottom" }, "the key by clicking the See My Keys button below, or going to")), /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentSuccess.code.goToMyPurchasedItem" }, /* @__PURE__ */ e.createElement("p", { className: "goToPurchasedItemContainer" }, /* @__PURE__ */ e.createElement("span", null, "My Account"), /* @__PURE__ */ e.createElement(p, { className: a("arrow", u.right) }), /* @__PURE__ */ e.createElement("span", null, "Purchased Items"), /* @__PURE__ */ e.createElement(p, { className: a("arrow", u.right) }), /* @__PURE__ */ e.createElement("span", null, "Product Keys")))) : r === l.enum.OPTIONBOX ? /* @__PURE__ */ e.createElement("div", { className: "optionboxPayment" }, /* @__PURE__ */ e.createElement("p", { className: "headingPayment" }, /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.content.optionbox.thanks" }, "Thank you! Your payment of ", /* @__PURE__ */ e.createElement("span", { className: "text-[color:rgb(var(--od-rgba-text))]" }, { price: y }), " was successful.")), /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentSuccess.optionbox.description" }, /* @__PURE__ */ e.createElement("p", { className: "paymentDescription mt-5" }, "Please click the button below to open the option box and select the item you want to claim."), /* @__PURE__ */ e.createElement("p", { className: "paymentDescription mt-7" }, "You also can open the option box later at:")), /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentSuccess.optionbox.goToMyPurchasedItem" }, /* @__PURE__ */ e.createElement("p", { className: "goToOptionBoxPage" }, /* @__PURE__ */ e.createElement("span", null, "My Account"), /* @__PURE__ */ e.createElement(p, { className: a("arrow", u.right) }), /* @__PURE__ */ e.createElement("span", null, "Purchased Items"), /* @__PURE__ */ e.createElement(p, { className: a("arrow", u.right) }), /* @__PURE__ */ e.createElement("span", null, "Option Box")))) : /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentSuccess.content" }, /* @__PURE__ */ e.createElement("p", { className: "description above" }, "Thank you!"), /* @__PURE__ */ e.createElement("p", { className: "description" }, "Your payment of ", /* @__PURE__ */ e.createElement("span", { className: "price" }, { price: y }), " was successful."))),
      /* @__PURE__ */ e.createElement(i, { className: "dialogFooter" }, r === l.enum.CODE ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(g, { isLoading: n, onClick: this.handleClose }), !E && /* @__PURE__ */ e.createElement(b, { to: N.PurchasedKeys.makePath() }, /* @__PURE__ */ e.createElement(P, { className: "btn btn-primary btnSeeKeys" }, /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentSuccess.button.seeMyKeys" }, "See My Keys")))) : r === l.enum.OPTIONBOX ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(g, { isLoading: n, onClick: this.handleClose }), !E && /* @__PURE__ */ e.createElement(b, { to: N.PurchasedOptionbox.makePath() }, /* @__PURE__ */ e.createElement(P, { className: "btn btn-primary btnSeeKeys" }, /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentSuccess.button.optionbox" }, "See My Optionbox")))) : /* @__PURE__ */ e.createElement(g, { className: "nonCode", isLoading: n, onClick: this.handleClose }))
    );
  }
}
class Q extends e.Component {
  constructor() {
    super(...arguments), this.defaultProps = { isOpen: !0 };
  }
  render() {
    const { isOpen: n } = this.props;
    return /* @__PURE__ */ e.createElement(c, { title: "Processing Payment", isOpen: n || this.defaultProps.isOpen, className: a("paymentStatusDialog") }, /* @__PURE__ */ e.createElement(m, { className: "dialogBody processedCountdown" }, /* @__PURE__ */ e.createElement(S, { className: a(C.blue, "spinner") }), /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.StatusProcessedTimeout.content" }, /* @__PURE__ */ e.createElement("p", null, "Your payment is now being processed. Please wait for a few seconds..."))));
  }
}
class U extends e.Component {
  constructor() {
    super(...arguments), this.defaultProps = { isOpen: !0 };
  }
  render() {
    const { onClose: n, isOpen: s } = this.props;
    return /* @__PURE__ */ e.createElement(
      c,
      {
        title: "Processing Payment",
        isOpen: s || this.defaultProps.isOpen,
        className: a("paymentStatusDialog needMoreTime")
      },
      /* @__PURE__ */ e.createElement(m, { className: "dialogBody needMoreTime" }, /* @__PURE__ */ e.createElement("img", { src: K, alt: "order pending" }), /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentProcessed.content" }, /* @__PURE__ */ e.createElement("p", { className: "description above" }, "Your payment is still being processed, which may take up to 15 minutes. You will be notified via email"), /* @__PURE__ */ e.createElement("p", { className: "description " }, "when your payment has been processed. For assistance, please contact support."))),
      n && /* @__PURE__ */ e.createElement(i, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("button", { className: "btn btnClose failed", onClick: n }, /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentFailed.close" }, "CLOSE")))
    );
  }
}
class V extends e.Component {
  render() {
    return /* @__PURE__ */ e.createElement(
      c,
      {
        title: D("PaymentStatusDialog.paymentFailed.title"),
        isOpen: !0,
        className: a("paymentStatusDialog", this.props.className)
      },
      /* @__PURE__ */ e.createElement(m, { className: "dialogBody failed" }, /* @__PURE__ */ e.createElement("img", { src: w, alt: "Payment Failed" }), /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentFailed.content" }, /* @__PURE__ */ e.createElement("p", { className: "description above" }, "Your payment has failed."), /* @__PURE__ */ e.createElement("p", { className: "description" }, "Please contact support for assistance."))),
      /* @__PURE__ */ e.createElement(i, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("button", { onClick: this.props.onCloseDialog, className: "btn btnClose failed" }, /* @__PURE__ */ e.createElement(t, { i18nKey: "PaymentStatusDialog.paymentFailed.close" }, "CLOSE")))
    );
  }
}
class W extends e.Component {
  render() {
    return /* @__PURE__ */ e.createElement(
      c,
      {
        title: /* @__PURE__ */ e.createElement(t, { i18nKey: "OrderPage.cancellationnotice.title" }, "Order Cancelled"),
        isOpen: !0,
        className: a("paymentStatusDialog", this.props.className)
      },
      /* @__PURE__ */ e.createElement(m, { className: "dialogBody" }, /* @__PURE__ */ e.createElement("img", { src: f, alt: "Order cancelled" }), /* @__PURE__ */ e.createElement("p", { className: "description above" }, /* @__PURE__ */ e.createElement(t, { i18nKey: "OrderPage.cancellationNotice.message" }, "Your order has been successfully canceled. Head back to the store to explore other awesome games."))),
      /* @__PURE__ */ e.createElement(i, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("button", { className: "btn btnClose cancelled", onClick: this.props.onCloseDialog }, /* @__PURE__ */ e.createElement(t, { i18nKey: "OrderPage.cancellationNotice.closeButton" }, "Close")))
    );
  }
}
class Z extends e.Component {
  render() {
    return /* @__PURE__ */ e.createElement(
      c,
      {
        title: /* @__PURE__ */ e.createElement(t, { i18nKey: "OrderPage.expiryDialog.title" }, "Order Expired"),
        isOpen: !0,
        className: a("paymentStatusDialog", this.props.className)
      },
      /* @__PURE__ */ e.createElement(m, { className: "dialogBody" }, /* @__PURE__ */ e.createElement("img", { src: f, alt: "Order expired" }), /* @__PURE__ */ e.createElement("p", { className: "description above" }, /* @__PURE__ */ e.createElement(t, { i18nKey: "OrderPage.expiryDialog.message" }, "Your order has expired. Please return to the store to place a new order."))),
      /* @__PURE__ */ e.createElement(i, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("button", { className: "btn btnClose expired", onClick: this.props.onCloseDialog }, /* @__PURE__ */ e.createElement(t, { i18nKey: "OrderPage.expiryDialog.closeButton" }, "Close")))
    );
  }
}
export {
  W as OrderCancelledDialog,
  Z as OrderExpiredDialog,
  V as PaymentStatusFailedDialog,
  U as PaymentStatusNeedMoreTimeProcessedDialog,
  Q as PaymentStatusProcessedCountDownDialog,
  J as PaymentStatusSuccessDialog
};
