import { r as registerInstance, B as Build, h } from './index-33e43734.js';
import { t as toastController } from './overlays-97615cf7.js';
import { g as getCache } from './getCache-721d3aa5.js';
import { c as clearCache } from './clearCache-c95ee576.js';
import './ionic-global-bd76bde2.js';
import './helpers-a9270f9e.js';
import './localforage-9915b7c8.js';
import './_commonjsHelpers-cca61ea8.js';

const modalOnboardingCss = "modal-onboarding .banner{background-color:var(--ion-color-secondary)}modal-onboarding ion-content{--background:var(--ion-color-base) !important}modal-onboarding h1{color:#fff}modal-onboarding p{margin:0 0 15px 0;color:rgba(255, 255, 255, 0.8);font-weight:normal}.modal-onboarding{--width:700px;--max-width:700px}@media only screen and (max-width: 800px){.modal-onboarding{--width:100%;--max-width:auto}}";

let ModalOnboarding = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.user = {};
  }
  async onReset(event) {
    if (event.detail.endpoint === "editUser") {
      await clearCache("referredBy");
      const onboardingModalEl = document.querySelector("ion-modal.modal-onboarding");
      if (onboardingModalEl === null || onboardingModalEl === void 0 ? void 0 : onboardingModalEl.dismiss) {
        await onboardingModalEl.dismiss();
      }
    }
  }
  async onSuccess(event) {
    var _a;
    if (((_a = event.detail) === null || _a === void 0 ? void 0 : _a.endpoint) === "editUser") {
      await clearCache("referredBy");
      const onboardingModalEl = document.querySelector("ion-modal.modal-onboarding");
      if (onboardingModalEl === null || onboardingModalEl === void 0 ? void 0 : onboardingModalEl.dismiss) {
        await onboardingModalEl.dismiss();
        this.presentToast();
      }
    }
  }
  async presentToast() {
    const toast = await toastController.create({
      message: `Your profile has been setup successfully!`,
      duration: 3000,
    });
    toast.present();
  }
  async componentDidLoad() {
    if (!(Build === null || Build === void 0 ? void 0 : Build.isBrowser))
      return;
    this.referralId = await getCache("referredBy", null);
  }
  render() {
    var _a, _b, _c, _d;
    return (h("ion-content", null, h("div", { class: "banner ion-padding" }, h("h1", null, "Finish your Profile"), h("p", null, "Complete the fields below to finish setting up your profile.")), h("fireenjin-form", { class: "ion-padding", name: "onboarding", endpoint: "editUser", documentId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id, formData: {
        firstName: (_b = this.user) === null || _b === void 0 ? void 0 : _b.firstName,
        lastName: (_c = this.user) === null || _c === void 0 ? void 0 : _c.lastName,
        isOnboarded: true,
        referralId: this.referralId,
      }, resetButton: "Later", resetButtonColor: "medium" }, h("fireenjin-input", { label: "First Name", labelPosition: "stacked", placeholder: "What is your first name?", name: "firstName", value: this.user.firstName }), h("fireenjin-input", { label: "Last Name", labelPosition: "stacked", placeholder: "What is your last name?", name: "lastName", value: this.user.lastName }), h("fireenjin-radios", { name: "type", label: "Type", labelPosition: "stacked", options: [
        {
          label: "Referral Partner",
          value: "referral",
        },
        {
          label: "Property Owner / Manager",
          value: "property",
        },
        {
          label: "Claims Representaive",
          value: "insurance",
        },
      ], value: (_d = this.user) === null || _d === void 0 ? void 0 : _d.type }))));
  }
};
ModalOnboarding.style = modalOnboardingCss;

export { ModalOnboarding as modal_onboarding };

//# sourceMappingURL=modal-onboarding.entry.js.map