import { N as d, a as h, o as x, q as b, b as m, p as f, e as j, j as e, M as k, a9 as F, i as v, T as I } from "./index-c65ca4a4.mjs";
import { F as X } from "./Form-f4ced0f0.mjs";
import { I as y } from "./IntegrationHeader-a0a2e0a4.mjs";
const N = d.create(() => {
  const { updateRoute: o } = h(), g = d.useModal(), { settings: a } = x(), { mutateAsync: u } = b(), [s, n] = m(""), [r, i] = m(!1), [l] = f(a, ["firstpromoter"]), [c] = f(a, ["firstpromoter_id"]);
  j(() => {
    i(l || !1), n(c || "");
  }, [l, c]);
  const p = async () => {
    await u([
      {
        key: "firstpromoter",
        value: r
      },
      {
        key: "firstpromoter_id",
        value: s
      }
    ]);
  };
  return /* @__PURE__ */ e.jsxs(
    k,
    {
      afterClose: () => {
        o("integrations");
      },
      okColor: "black",
      okLabel: "Save & close",
      testId: "firstpromoter-modal",
      title: "",
      onOk: async () => {
        await p(), o("integrations"), g.remove();
      },
      children: [
        /* @__PURE__ */ e.jsx(
          y,
          {
            detail: "Launch your own member referral program",
            icon: /* @__PURE__ */ e.jsx(F, { className: "-mt-2 h-14 w-14" }),
            title: "FirstPromoter"
          }
        ),
        /* @__PURE__ */ e.jsx("div", { className: "mt-7", children: /* @__PURE__ */ e.jsxs(X, { marginBottom: !1, title: "FirstPromoter configuration", grouped: !0, children: [
          /* @__PURE__ */ e.jsx(
            v,
            {
              checked: r,
              direction: "rtl",
              hint: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
                "Enable ",
                /* @__PURE__ */ e.jsx("a", { className: "text-green", href: "https://firstpromoter.com/?fpr=ghost&fp_sid=admin", rel: "noopener noreferrer", target: "_blank", children: "FirstPromoter" }),
                " for tracking referrals"
              ] }),
              label: "Enable FirstPromoter",
              onChange: (t) => {
                i(t.target.checked);
              }
            }
          ),
          r && /* @__PURE__ */ e.jsx(
            I,
            {
              hint: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
                "Affiliate and referral tracking, find your ID  ",
                /* @__PURE__ */ e.jsx("a", { className: "text-green", href: "https://ghost.org/help/firstpromoter-id/", rel: "noopener noreferrer", target: "_blank", children: "here" })
              ] }),
              placeholder: "XXXXXXXX",
              title: "FirstPromoter account ID",
              value: s,
              onChange: (t) => {
                n(t.target.value);
              }
            }
          )
        ] }) })
      ]
    }
  );
});
export {
  N as default
};
//# sourceMappingURL=FirstPromoterModal-41e010e6.mjs.map
