import { Wizard } from "./wizardStateMachine";
import isEmpty from "lodash/isEmpty";
export var DOMAIN_PRESALE_STEPS;
(function (DOMAIN_PRESALE_STEPS) {
    DOMAIN_PRESALE_STEPS[DOMAIN_PRESALE_STEPS["SELECT_DOMAIN"] = 0] = "SELECT_DOMAIN";
    DOMAIN_PRESALE_STEPS[DOMAIN_PRESALE_STEPS["AUTHENTICATE"] = 1] = "AUTHENTICATE";
    DOMAIN_PRESALE_STEPS[DOMAIN_PRESALE_STEPS["CREATE_USER"] = 2] = "CREATE_USER";
    DOMAIN_PRESALE_STEPS[DOMAIN_PRESALE_STEPS["DONE"] = 3] = "DONE";
})(DOMAIN_PRESALE_STEPS || (DOMAIN_PRESALE_STEPS = {}));
const cachedOnboarding = JSON.parse(sessionStorage.getItem("cachedOnboarding") || "null");
const defaultState = {
    form: {},
    justCreated: false,
    inviteHashVerified: false,
    legacyToken: "",
    legacyUsername: "",
    isLegacyUpdateOngoing: false,
    formUsernameIsAvailable: "",
    progressedSteps: [],
    wizard: Wizard.create({ current: "HASH_VERIFY", hasNext: false, hasPrev: false }, { current: "HASH_VERIFY", hasNext: false, hasPrev: false }),
};
export const state = cachedOnboarding
    ? {
        ...defaultState,
        form: cachedOnboarding.form,
        wizard: Wizard.create({
            current: "HASH_VERIFY",
            hasNext: !isEmpty(cachedOnboarding.form.inviteHash),
            hasPrev: false,
            nextLink: !isEmpty(cachedOnboarding.form.inviteHash) ? "" : "/signup/auth",
        }, {
            current: "HASH_VERIFY",
            hasNext: !isEmpty(cachedOnboarding.form.inviteHash),
            hasPrev: false,
            nextLink: isEmpty(cachedOnboarding.form.inviteHash) ? "" : "/signup/auth",
        }),
    }
    : defaultState;
//# sourceMappingURL=state.js.map