'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-fd2bbf0b.js');
const hardwareBackButton = require('./overlays-0248227e.js');
const getCache = require('./getCache-0269c4d0.js');
const clearCache = require('./clearCache-94708ed2.js');
require('./ionic-global-1340f737.js');
require('./helpers-c2496722.js');
require('./localforage-af1b8c0e.js');
require('./_commonjsHelpers-a5111d61.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) {
    index.registerInstance(this, hostRef);
    this.user = {};
  }
  async onReset(event) {
    if (event.detail.endpoint === "editUser") {
      await clearCache.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.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 hardwareBackButton.toastController.create({
      message: `Your profile has been setup successfully!`,
      duration: 3000,
    });
    toast.present();
  }
  async componentDidLoad() {
    if (!(index.Build === null || index.Build === void 0 ? void 0 : index.Build.isBrowser))
      return;
    this.referralId = await getCache.getCache("referredBy", null);
  }
  render() {
    var _a, _b, _c, _d;
    return (index.h("ion-content", null, index.h("div", { class: "banner ion-padding" }, index.h("h1", null, "Finish your Profile"), index.h("p", null, "Complete the fields below to finish setting up your profile.")), index.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" }, index.h("fireenjin-input", { label: "First Name", labelPosition: "stacked", placeholder: "What is your first name?", name: "firstName", value: this.user.firstName }), index.h("fireenjin-input", { label: "Last Name", labelPosition: "stacked", placeholder: "What is your last name?", name: "lastName", value: this.user.lastName }), index.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;

exports.modal_onboarding = ModalOnboarding;

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