Files
appco_dist/.output/server/chunks/build/index-Doqmsr4V.mjs
T
2026-02-23 12:50:59 +03:30

458 lines
18 KiB
JavaScript

import { defineComponent, ref, reactive, mergeProps, unref, withCtx, createVNode, openBlock, createBlock, createTextVNode, toDisplayString, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate } from 'vue/server-renderer';
import { u as useRouter$1, a as useConfigStore, b as useUserStore, f as generateOtp, d as api$1, v as verifyOtp, c as setToken, s as supabase, i as setPassword, j as setBirthday, k as setNames } from './server.mjs';
import OtpInput from 'vue3-otp-input';
import { B as BasicInput } from './BasicInput-CgQV_gT5.mjs';
import { B as BaseDatePicker, a as BaseDatePickerJalali } from './BaseDatePicker-D3_e-ycp.mjs';
import { B as BasicButton } from './BasicButton-7YIRCRg8.mjs';
import { B as BasicIconOld } from './BasicIconOld-Booq7UXp.mjs';
import { _ as __nuxt_component_1 } from './FormItem-Uo-Qw9vC.mjs';
import '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import 'consola';
import 'fast-xml-parser';
import 'ipx';
import 'pinia';
import '@supabase/supabase-js';
import 'axios';
import 'lodash-es';
import '@babel/runtime/helpers/esm/extends';
import '@babel/runtime/helpers/esm/objectSpread2';
import '@ant-design/colors';
import '@ctrl/tinycolor';
import 'stylis';
import 'vue-types';
import '@ant-design/icons-vue';
import 'unhead/utils';
import './usePrice-CFcNV1RQ.mjs';
import './index-D4HrLPqa.mjs';
import './FormItemContext-DTpHAXaY.mjs';
import './index-BTlbWWOl.mjs';
import 'lodash-es/isPlainObject.js';
import 'resize-observer-polyfill';
import './index-DN2Eqyc3.mjs';
import 'dom-align';
import 'moment-jalaali';
import 'dayjalali';
import './index-CnnQbQCE.mjs';
import './useMergedState-BZEfJ8Fl.mjs';
import './move-DCvQW68K.mjs';
import './shallowequal-CJsWvZb3.mjs';
import './_plugin-vue_export-helper-1tPrXgE0.mjs';
import './index-CO_xVqO1.mjs';
import 'throttle-debounce';
import 'lodash-es/cloneDeep.js';
import 'async-validator';
import 'lodash-es/find.js';
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
setup(__props) {
const router = useRouter$1();
const step = ref("mobile");
const config = useConfigStore();
const isBack = ref(false);
const loading = ref(false);
const user = useUserStore();
const form = reactive({
mobile: void 0,
otp: void 0,
password: void 0,
first_name: void 0,
last_name: void 0,
birthday: void 0,
agree: void 0
});
function handleOnChange(value) {
}
async function handleOnComplete(value) {
form.otp = value;
}
const goNext = async () => {
try {
loading.value = true;
if (step.value === "mobile") {
const res = await generateOtp(form.mobile, "signup");
if (res?.user?.id) {
api$1.error(config.useString("userHaveAccount"));
router.push({
name: "auth-login"
});
return;
}
isBack.value = false;
step.value = "otp";
} else if (step.value === "otp") {
const res = await verifyOtp(form.mobile, form.otp);
console.log("res ===>", res);
setToken(res.session.access_token);
await supabase.auth.setSession(res.session);
user.getUserInfo();
isBack.value = false;
step.value = "password";
} else if (step.value === "password") {
if (form.password.length < 6) {
api$1.error(config.useString("minPassIs6"));
return;
}
const res = await setPassword(form.password);
isBack.value = false;
step.value = "birthday";
} else if (step.value === "birthday") {
const res = await setBirthday(form.birthday);
isBack.value = false;
step.value = "name";
} else if (step.value === "name") {
const res = await setNames(form.first_name, form.last_name);
isBack.value = false;
step.value = "agree";
} else if (step.value === "agree") {
await router.push({
name: "home"
});
}
} catch (e) {
console.log("e ===>", e);
} finally {
loading.value = false;
}
};
return (_ctx, _push, _parent, _attrs) => {
const _component_a_form_item = __nuxt_component_1;
_push(`<div${ssrRenderAttrs(mergeProps({
class: "p-4 bgRegister w-full h-screen"
}, _attrs))}><div class="font-semibold text-2xl"><div class="absolute bottom-0 right-0 left-0 w-full text-center text-sm">`);
if (step.value === "mobile") {
_push(`<div class="pb-5 text-primary cursor-pointer">${ssrInterpolate(unref(config).useString("iHaveAccount"))}</div>`);
} else {
_push(`<!---->`);
}
_push(`</div>`);
if (step.value === "mobile") {
_push(`<div class="mt-5">${ssrInterpolate(unref(config).useString("registerMobile"))}</div>`);
} else if (step.value === "otp") {
_push(`<div><div class="flex items-center justify-left">`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:arrow-left-1",
class: "mb-5 font-semibold cursor-pointer",
size: "26",
onClick: ($event) => {
isBack.value = true;
step.value = "mobile";
}
}, null, _parent));
_push(`</div> ${ssrInterpolate(unref(config).useString("registerOtp"))}</div>`);
} else if (step.value === "password") {
_push(`<div><div class="flex items-center justify-left">`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:arrow-left-1",
class: "mb-5 font-semibold cursor-pointer",
size: "26",
onClick: ($event) => {
isBack.value = true;
step.value = "mobile";
}
}, null, _parent));
_push(`</div> ${ssrInterpolate(unref(config).useString("registerPassword"))}</div>`);
} else if (step.value === "birthday") {
_push(`<div><div class="flex items-center justify-left">`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:arrow-left-1",
class: "mb-5 font-semibold cursor-pointer",
size: "26",
onClick: ($event) => {
isBack.value = true;
step.value = "password";
}
}, null, _parent));
_push(`</div> ${ssrInterpolate(unref(config).useString("registerBirthday"))}</div>`);
} else if (step.value === "name") {
_push(`<div><div class="flex items-center justify-left">`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:arrow-left-1",
class: "mb-5 font-semibold cursor-pointer",
size: "26",
onClick: ($event) => {
isBack.value = true;
step.value = "birthday";
}
}, null, _parent));
_push(`</div> ${ssrInterpolate(unref(config).useString("registerName"))}</div>`);
} else if (step.value === "agree") {
_push(`<div><div class="flex items-center justify-left">`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:arrow-left-1",
class: "mb-5 font-semibold cursor-pointer",
size: "26",
onClick: ($event) => {
isBack.value = true;
step.value = "name";
}
}, null, _parent));
_push(`</div> ${ssrInterpolate(unref(config).useString("registerAgree"))}</div>`);
} else {
_push(`<!---->`);
}
_push(`</div><div class="mt-2">`);
if (step.value === "mobile") {
_push(`<div>${ssrInterpolate(unref(config).useString("registerMobileDescription1"))}</div>`);
} else if (step.value === "otp") {
_push(`<div>${ssrInterpolate(unref(config).useString("registerOtpDescription", form.mobile))}</div>`);
} else if (step.value === "password") {
_push(`<div>${ssrInterpolate(unref(config).useString("registerPasswordDescription"))}</div>`);
} else if (step.value === "birthday") {
_push(`<div>${ssrInterpolate(unref(config).useString("registerBirthdayDescription"))}</div>`);
} else if (step.value === "name") {
_push(`<div>${ssrInterpolate(unref(config).useString("registerNameDescription"))}</div>`);
} else if (step.value === "agree") {
_push(`<div class="text-justify">${ssrInterpolate(unref(config).useString("registerAgreeDescription"))}</div>`);
} else {
_push(`<!---->`);
}
_push(`</div><div class="mt-2">`);
if (step.value === "mobile") {
_push(`<div>`);
_push(ssrRenderComponent(_component_a_form_item, {
name: "mobile"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(BasicInput, {
value: form.mobile,
"onUpdate:value": ($event) => form.mobile = $event,
size: "large",
"place-holder": unref(config).useString("phone")
}, null, _parent2, _scopeId));
} else {
return [createVNode(BasicInput, {
value: form.mobile,
"onUpdate:value": ($event) => form.mobile = $event,
size: "large",
"place-holder": unref(config).useString("phone")
}, null, 8, ["value", "onUpdate:value", "place-holder"])];
}
}),
_: 1
}, _parent));
_push(`<div>${ssrInterpolate(unref(config).useString("registerMobileDescription2"))}</div></div>`);
} else if (step.value === "otp") {
_push(`<div>`);
_push(ssrRenderComponent(_component_a_form_item, {
name: "otp"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(unref(OtpInput), {
style: {
"direction": "ltr"
},
class: "mt-10 justify-center",
ref: "otpInput",
autocomplete: "one-time-code",
"input-classes": "otp-input",
separator: "",
"num-inputs": 5,
"should-auto-focus": true,
"is-input-num": true,
onOnChange: handleOnChange,
onOnComplete: handleOnComplete
}, null, _parent2, _scopeId));
} else {
return [createVNode(unref(OtpInput), {
style: {
"direction": "ltr"
},
class: "mt-10 justify-center",
ref: "otpInput",
autocomplete: "one-time-code",
"input-classes": "otp-input",
separator: "",
"num-inputs": 5,
"should-auto-focus": true,
"is-input-num": true,
onOnChange: handleOnChange,
onOnComplete: handleOnComplete
}, null, 512)];
}
}),
_: 1
}, _parent));
_push(`</div>`);
} else if (step.value === "password") {
_push(`<div>`);
_push(ssrRenderComponent(_component_a_form_item, {
name: "password"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(BasicInput, {
value: form.password,
"onUpdate:value": ($event) => form.password = $event,
"is-password": "",
size: "large",
"place-holder": unref(config).useString("password")
}, null, _parent2, _scopeId));
} else {
return [createVNode(BasicInput, {
value: form.password,
"onUpdate:value": ($event) => form.password = $event,
"is-password": "",
size: "large",
"place-holder": unref(config).useString("password")
}, null, 8, ["value", "onUpdate:value", "place-holder"])];
}
}),
_: 1
}, _parent));
_push(`</div>`);
} else if (step.value === "birthday") {
_push(`<div>`);
_push(ssrRenderComponent(_component_a_form_item, {
name: "birthday"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
if (unref(config).lang === "en" && unref(config).APP_Milady_Date) {
_push2(ssrRenderComponent(unref(BaseDatePicker), {
value: form.birthday,
"onUpdate:value": ($event) => form.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate"),
size: "large"
}, null, _parent2, _scopeId));
} else {
_push2(ssrRenderComponent(unref(BaseDatePickerJalali), {
value: form.birthday,
"onUpdate:value": ($event) => form.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate"),
size: "large"
}, null, _parent2, _scopeId));
}
} else {
return [unref(config).lang === "en" && unref(config).APP_Milady_Date ? (openBlock(), createBlock(unref(BaseDatePicker), {
key: 0,
value: form.birthday,
"onUpdate:value": ($event) => form.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate"),
size: "large"
}, null, 8, ["value", "onUpdate:value", "placeHolder"])) : (openBlock(), createBlock(unref(BaseDatePickerJalali), {
key: 1,
value: form.birthday,
"onUpdate:value": ($event) => form.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate"),
size: "large"
}, null, 8, ["value", "onUpdate:value", "placeHolder"]))];
}
}),
_: 1
}, _parent));
_push(`</div>`);
} else if (step.value === "name") {
_push(`<div>`);
_push(ssrRenderComponent(_component_a_form_item, {
name: "first_name"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(BasicInput, {
placeHolder: unref(config).useString("firstNamePlaceholder"),
value: form.first_name,
"onUpdate:value": ($event) => form.first_name = $event,
size: "large"
}, null, _parent2, _scopeId));
} else {
return [createVNode(BasicInput, {
placeHolder: unref(config).useString("firstNamePlaceholder"),
value: form.first_name,
"onUpdate:value": ($event) => form.first_name = $event,
size: "large"
}, null, 8, ["placeHolder", "value", "onUpdate:value"])];
}
}),
_: 1
}, _parent));
_push(ssrRenderComponent(_component_a_form_item, {
name: "last_name"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(BasicInput, {
placeHolder: unref(config).useString("lastNamePlaceholder"),
value: form.last_name,
"onUpdate:value": ($event) => form.last_name = $event,
size: "large"
}, null, _parent2, _scopeId));
} else {
return [createVNode(BasicInput, {
placeHolder: unref(config).useString("lastNamePlaceholder"),
value: form.last_name,
"onUpdate:value": ($event) => form.last_name = $event,
size: "large"
}, null, 8, ["placeHolder", "value", "onUpdate:value"])];
}
}),
_: 1
}, _parent));
_push(`</div>`);
} else if (step.value === "agree") {
_push(`<div></div>`);
} else {
_push(`<!---->`);
}
_push(ssrRenderComponent(BasicButton, {
block: "",
class: "mt-5",
type: "primary",
onClick: goNext,
loading: loading.value,
curve: "",
size: "large"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`${ssrInterpolate(unref(config).useString("next"))}`);
} else {
return [createTextVNode(toDisplayString(unref(config).useString("next")), 1)];
}
}),
_: 1
}, _parent));
_push(`</div><div></div></div>`);
};
}
});
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/register/index.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
setup(__props) {
return (_ctx, _push, _parent, _attrs) => {
_push(ssrRenderComponent(_sfc_main$1, _attrs, null, _parent));
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/auth/register/index.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };