79 lines
2.5 KiB
JavaScript
79 lines
2.5 KiB
JavaScript
import { a as useNuxtApp, V as VuesaxIcon_default } from '../virtual/entry.mjs';
|
|
import { defineComponent, mergeProps, useSSRContext } from 'vue';
|
|
import { ssrRenderComponent } from 'vue/server-renderer';
|
|
import { defineStore } from 'pinia';
|
|
|
|
//#region app/components/ui/DynamicIcon.vue?vue&type=script&setup=true&lang.ts
|
|
var DynamicIcon_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
__name: "DynamicIcon",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
name: {},
|
|
size: {}
|
|
},
|
|
setup(__props) {
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(ssrRenderComponent(VuesaxIcon_default, mergeProps({
|
|
name: __props.name,
|
|
size: __props.size
|
|
}, _attrs), null, _parent));
|
|
};
|
|
}
|
|
});
|
|
//#endregion
|
|
//#region app/components/ui/DynamicIcon.vue
|
|
var _sfc_setup = DynamicIcon_vue_vue_type_script_setup_true_lang_default.setup;
|
|
DynamicIcon_vue_vue_type_script_setup_true_lang_default.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/ui/DynamicIcon.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
var DynamicIcon_default = Object.assign(DynamicIcon_vue_vue_type_script_setup_true_lang_default, { __name: "UiDynamicIcon" });
|
|
//#endregion
|
|
//#region app/stores/contact.ts
|
|
/** `website` is a honeypot field, hidden from people and left empty */
|
|
var emptyForm = () => ({
|
|
name: "",
|
|
org: "",
|
|
phone: "",
|
|
message: "",
|
|
website: ""
|
|
});
|
|
var useContactStore = defineStore("contact", {
|
|
state: () => ({
|
|
form: emptyForm(),
|
|
status: "idle",
|
|
error: ""
|
|
}),
|
|
actions: {
|
|
async submit() {
|
|
this.status = "loading";
|
|
this.error = "";
|
|
try {
|
|
await useNuxtApp().$api("/public/contact", {
|
|
method: "POST",
|
|
body: this.form
|
|
});
|
|
this.status = "success";
|
|
} catch (e) {
|
|
const err = e;
|
|
this.error = err.statusCode === 429 ? "تعداد درخواستها زیاد است؛ لطفاً چند دقیقه بعد دوباره تلاش کنید." : err.data?.message ?? "ارسال درخواست انجام نشد؛ لطفاً دوباره تلاش کنید یا تماس بگیرید.";
|
|
this.status = "error";
|
|
}
|
|
},
|
|
/** Pre-fills the message, e.g. from a product page's "request a quote" button */
|
|
prefill(message) {
|
|
if (this.status === "success") this.reset();
|
|
this.form.message = message;
|
|
},
|
|
reset() {
|
|
this.form = emptyForm();
|
|
this.status = "idle";
|
|
this.error = "";
|
|
}
|
|
}
|
|
});
|
|
|
|
export { DynamicIcon_default as D, useContactStore as u };
|
|
//# sourceMappingURL=contact-DBTK0GHP.mjs.map
|