396 lines
18 KiB
JavaScript
396 lines
18 KiB
JavaScript
import { defineComponent, ref, computed, withAsyncContext, watch, resolveDirective, unref, withCtx, createVNode, createBlock, openBlock, toDisplayString, createTextVNode, mergeProps, useSSRContext } from 'vue';
|
|
import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate, ssrRenderAttr, ssrRenderList, ssrGetDirectiveProps, ssrRenderStyle } from 'vue/server-renderer';
|
|
import { _ as _imports_0, a as _imports_1 } from './cart-DMkYna66.mjs';
|
|
import { _ as __nuxt_component_1, a as _sfc_main$6, b as _imports_2, c as _imports_3, d as _sfc_main$5, H as Highlights } from './Highlights-B4lWZTzT.mjs';
|
|
import { u as useRouter$1, a as useConfigStore, b as useUserStore, p as useCartStore, n as useIntersectionObserver, q as APP_TYPE, t as reactiveProjectName, o as getToken, B as getSupabaseStorageUrl, e as appName } from './server.mjs';
|
|
import { B as BasicIconOld } from './BasicIconOld-93vAWohq.mjs';
|
|
import numbro from 'numbro';
|
|
import { B as BasicButton } from './BasicButton-BY5Qzukq.mjs';
|
|
import { U as UserProfilePic } from './UserProfilePic-KbXFtZ-c.mjs';
|
|
import { l as loadGray, S as SquarePostSkeleton } from './gray-C7jWrJYc.mjs';
|
|
import { _ as _sfc_main$3 } from './FullScreenStories-BrNWaEPe.mjs';
|
|
import { u as useMediaStore } from './media-fadondUH.mjs';
|
|
import { u as useUserPostStore } from './userPostsStore-CNw-pHXp.mjs';
|
|
import { u as useAsyncData } from './asyncData-DGiCewbG.mjs';
|
|
import { B as Badge } from './index-DtARpN4h.mjs';
|
|
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
|
|
import '@babel/runtime/helpers/esm/objectSpread2';
|
|
import '@babel/runtime/helpers/esm/extends';
|
|
import './index-D6zsIMlW.mjs';
|
|
import './raf-ruCY1ktO.mjs';
|
|
import 'dom-align';
|
|
import './media-TZzDk-n-.mjs';
|
|
import 'swiper/vue';
|
|
import './empty_user-BaUNCdgf.mjs';
|
|
import './post_loading-BiySI7bp.mjs';
|
|
import './index-DN7-byVZ.mjs';
|
|
import '@vueuse/gesture';
|
|
import '@headlessui/vue';
|
|
import '../_/nitro.mjs';
|
|
import 'node:http';
|
|
import 'node:https';
|
|
import 'node:events';
|
|
import 'node:buffer';
|
|
import 'node:fs';
|
|
import 'node:url';
|
|
import 'consola';
|
|
import 'ipx';
|
|
import 'node:path';
|
|
import 'node:crypto';
|
|
import 'framesync';
|
|
import 'popmotion';
|
|
import 'style-value-types';
|
|
import 'lodash-es';
|
|
import 'pinia';
|
|
import '@supabase/supabase-js';
|
|
import '@ant-design/colors';
|
|
import '@ctrl/tinycolor';
|
|
import 'stylis';
|
|
import 'vue-types';
|
|
import 'axios';
|
|
import '@ant-design/icons-vue';
|
|
import '../routes/renderer.mjs';
|
|
import 'vue-bundle-renderer/runtime';
|
|
import 'unhead/server';
|
|
import 'devalue';
|
|
import 'unhead/utils';
|
|
import './index-DWwHo7-N.mjs';
|
|
import 'throttle-debounce';
|
|
import 'vue-content-loader';
|
|
import './BasicInput-AVyieyz8.mjs';
|
|
import './usePrice-B-5-jXKQ.mjs';
|
|
import './index-Bp7LbEZG.mjs';
|
|
import './FormItemContext-2mj5AJzl.mjs';
|
|
import './index-atBrDcKY.mjs';
|
|
import 'lodash-es/isPlainObject.js';
|
|
import 'resize-observer-polyfill';
|
|
import './like-BhIOg3YL.mjs';
|
|
import 'swiper/modules';
|
|
|
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
__name: "Seller",
|
|
__ssrInlineRender: true,
|
|
async setup(__props) {
|
|
let __temp, __restore;
|
|
const router = useRouter$1();
|
|
const selectedStoryId = ref(null);
|
|
const visibleAdd = ref(false);
|
|
const config = useConfigStore();
|
|
const user = useUserStore();
|
|
const mediaStore = useMediaStore();
|
|
const cartStore = useCartStore();
|
|
const userPost = useUserPostStore();
|
|
const seller = computed(() => config.sellerConfig?.store);
|
|
const userStory = computed(() => {
|
|
return mediaStore.users.find((x) => x.id === seller.value?.id);
|
|
});
|
|
const formatNumber = (num) => {
|
|
if (num < 9999) return num;
|
|
return numbro(num).format({
|
|
average: true,
|
|
// Converts 11230 -> 11.2K, 1000000 -> 1M
|
|
mantissa: 1
|
|
// Number of decimal places
|
|
});
|
|
};
|
|
const videoThumbnails = ref({});
|
|
async function shareProfile() {
|
|
if ((void 0).share) {
|
|
try {
|
|
await (void 0).share({
|
|
title: `${config.lang === "fa" ? `${appName.fa}` : `${appName.en}`}`,
|
|
text: `${seller.value?.bio}`,
|
|
url: `${(void 0).location.origin}/user`
|
|
});
|
|
} catch (error) {
|
|
console.error("Sharing failed", error);
|
|
}
|
|
} else {
|
|
alert("Web Share API not supported in this browser.");
|
|
}
|
|
}
|
|
const observer = ref();
|
|
useIntersectionObserver(observer, async ([{ isIntersecting }]) => {
|
|
if (isIntersecting && !userPost.loading && !userPost.endPage) {
|
|
setTimeout(async () => {
|
|
const nextPage = userPost.currentPage + 1;
|
|
const data2 = await userPost.loadPosts(seller.value?.user_id, nextPage);
|
|
userPost.loadStateNextPage(data2);
|
|
}, 100);
|
|
}
|
|
});
|
|
const { data } = ([__temp, __restore] = withAsyncContext(async () => useAsyncData("productMainSeller", async () => {
|
|
userPost.reset();
|
|
return await userPost.loadPosts(seller.value?.user_id, 1);
|
|
})), __temp = await __temp, __restore(), __temp);
|
|
watch(data, () => {
|
|
if (data) {
|
|
userPost.loadStateNextPage(data.value);
|
|
}
|
|
});
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_a_badge = Badge;
|
|
const _component_a_popover = __nuxt_component_1;
|
|
const _directive_lazy = resolveDirective("lazy");
|
|
let _temp0;
|
|
_push(`<div${ssrRenderAttrs(_attrs)} data-v-99a8b69d><div class="absolute top-0 w-inherit right-0 left-0" data-v-99a8b69d><div class="flex justify-between w-full p-4" data-v-99a8b69d><div class="font-semibold text-lg font-azar" data-v-99a8b69d>${ssrInterpolate(seller.value?.username)}</div><div class="flex gap6 items-center" data-v-99a8b69d>`);
|
|
if (!unref(config).isSeller && unref(APP_TYPE) === "single" || unref(APP_TYPE) === "multi") {
|
|
_push(ssrRenderComponent(_component_a_badge, {
|
|
count: unref(cartStore).count,
|
|
dir: "ltr",
|
|
class: "mt1"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<div data-v-99a8b69d${_scopeId}>`);
|
|
if (unref(config).isNightStore) {
|
|
_push2(`<img${ssrRenderAttr("src", _imports_0)} class="w-1.8rem -mt1" alt="" data-v-99a8b69d${_scopeId}>`);
|
|
} else {
|
|
_push2(`<img${ssrRenderAttr("src", _imports_1)}${ssrRenderAttr("alt", unref(reactiveProjectName))} class="w-1.8rem -mt1" data-v-99a8b69d${_scopeId}>`);
|
|
}
|
|
_push2(`</div>`);
|
|
} else {
|
|
return [
|
|
createVNode("div", {
|
|
onClick: ($event) => unref(router).push({ name: "cart" })
|
|
}, [
|
|
unref(config).isNightStore ? (openBlock(), createBlock("img", {
|
|
key: 0,
|
|
src: _imports_0,
|
|
class: "w-1.8rem -mt1",
|
|
alt: ""
|
|
})) : (openBlock(), createBlock("img", {
|
|
key: 1,
|
|
src: _imports_1,
|
|
alt: unref(reactiveProjectName),
|
|
class: "w-1.8rem -mt1"
|
|
}, null, 8, ["alt"]))
|
|
], 8, ["onClick"])
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (unref(getToken)() && unref(config).isSeller) {
|
|
_push(ssrRenderComponent(_component_a_popover, {
|
|
open: visibleAdd.value,
|
|
"onUpdate:open": ($event) => visibleAdd.value = $event,
|
|
trigger: "click"
|
|
}, {
|
|
content: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<div data-v-99a8b69d${_scopeId}><div class="flex items-center gap-2" data-v-99a8b69d${_scopeId}><img${ssrRenderAttr("src", _imports_2)} class="w-1rem"${ssrRenderAttr("alt", unref(reactiveProjectName))} data-v-99a8b69d${_scopeId}><div data-v-99a8b69d${_scopeId}>${ssrInterpolate(unref(config).useString("product"))}</div></div><div class="flex items-center gap-2 mt-2" data-v-99a8b69d${_scopeId}><img${ssrRenderAttr("src", _imports_3)} class="w-1rem"${ssrRenderAttr("alt", unref(reactiveProjectName))} data-v-99a8b69d${_scopeId}><div data-v-99a8b69d${_scopeId}>${ssrInterpolate(unref(config).useString("story"))}</div></div></div>`);
|
|
} else {
|
|
return [
|
|
createVNode("div", null, [
|
|
createVNode("div", {
|
|
class: "flex items-center gap-2",
|
|
onClick: ($event) => unref(router).push({ name: "add-product" })
|
|
}, [
|
|
createVNode("img", {
|
|
src: _imports_2,
|
|
class: "w-1rem",
|
|
alt: unref(reactiveProjectName)
|
|
}, null, 8, ["alt"]),
|
|
createVNode("div", null, toDisplayString(unref(config).useString("product")), 1)
|
|
], 8, ["onClick"]),
|
|
createVNode("div", {
|
|
class: "flex items-center gap-2 mt-2",
|
|
onClick: ($event) => unref(router).push({ name: "add-story" })
|
|
}, [
|
|
createVNode("img", {
|
|
src: _imports_3,
|
|
class: "w-1rem",
|
|
alt: unref(reactiveProjectName)
|
|
}, null, 8, ["alt"]),
|
|
createVNode("div", null, toDisplayString(unref(config).useString("story")), 1)
|
|
], 8, ["onClick"])
|
|
])
|
|
];
|
|
}
|
|
}),
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(_sfc_main$6, { class: "w-1.4rem" }, null, _parent2, _scopeId));
|
|
} else {
|
|
return [
|
|
createVNode(_sfc_main$6, { class: "w-1.4rem" })
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (unref(getToken)() && !unref(config).isSeller) {
|
|
_push(`<div data-v-99a8b69d>`);
|
|
_push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:profile-circle" }, null, _parent));
|
|
_push(`</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (!unref(getToken)()) {
|
|
_push(`<div data-v-99a8b69d>`);
|
|
_push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:login" }, null, _parent));
|
|
_push(`</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(ssrRenderComponent(_sfc_main$5, {
|
|
class: "w-1.3rem",
|
|
onClick: ($event) => unref(router).push({ name: "user-setting" })
|
|
}, null, _parent));
|
|
_push(`</div></div><div class="h-90vh overflow-y-auto pb-5vh" data-v-99a8b69d><div class="px4" data-v-99a8b69d><div class="flex" data-v-99a8b69d>`);
|
|
_push(ssrRenderComponent(UserProfilePic, {
|
|
src: seller.value?.avatar,
|
|
onClick: ($event) => userStory.value?.stories?.length === 0 || !userStory.value?.stories ? "" : selectedStoryId.value = seller.value?.id,
|
|
"just-show-profile": userStory.value?.stories?.length === 0 || !userStory.value?.stories,
|
|
seenStory: !userStory.value?.stories?.length || userStory.value?.stories?.every((item) => item.storyviews.find((_item) => _item.user_id === unref(user).user?.id || _item.user_id === "me")),
|
|
showAdd: unref(config).isSeller
|
|
}, null, _parent));
|
|
_push(`<div class="p3 text-sm" data-v-99a8b69d><div class="flex mt2 gap-3" data-v-99a8b69d><div class="" data-v-99a8b69d><div class="font-semibold" data-v-99a8b69d>${ssrInterpolate(formatNumber(seller.value?.stats?.total_product ?? 0))}</div><div data-v-99a8b69d>${ssrInterpolate(unref(config).useString("products"))}</div></div>`);
|
|
if (unref(config).isSeller) {
|
|
_push(`<div class="" data-v-99a8b69d><div class="font-semibold" data-v-99a8b69d>${ssrInterpolate(formatNumber(seller.value?.stats?.total_customer ?? 0))}</div><div data-v-99a8b69d>${ssrInterpolate(unref(config).useString("customers"))}</div></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<div class="" data-v-99a8b69d><div class="font-semibold" data-v-99a8b69d>${ssrInterpolate(formatNumber(unref(config).isSeller ? seller.value?.stats?.sell_total_order_count ?? 0 : unref(user)?.user?.stats?.buy_total_order_count ?? 0))}</div><div data-v-99a8b69d>${ssrInterpolate(unref(config).isSeller ? unref(config).useString("orders") : unref(config).useString("yourOrders"))}</div></div></div></div></div><div class="text-xs mt-5 font-yekan font-300 whitespace-pre-line" data-v-99a8b69d>${ssrInterpolate(seller.value?.bio)}</div>`);
|
|
if (seller.value?.website) {
|
|
_push(`<a${ssrRenderAttr("href", "https://" + seller.value?.website)} target="_blank" data-v-99a8b69d><div class="flex items-center text-xs gap-1 text-primary" data-v-99a8b69d>`);
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: "vuesax-linear:link-1",
|
|
class: "text-primary",
|
|
size: "20"
|
|
}, null, _parent));
|
|
_push(` ${ssrInterpolate(seller.value?.website)}</div></a>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (unref(getToken)()) {
|
|
_push(`<div class="flex items-center gap-2 mt-2" data-v-99a8b69d>`);
|
|
_push(ssrRenderComponent(BasicButton, {
|
|
size: "small",
|
|
block: "",
|
|
class: ["!h-unset !rounded-lg", unref(config).isNightStore ? "border-white text-white bg-black" : "border-black text-black"],
|
|
onClick: ($event) => unref(router).push({ name: "user-edit" })
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`${ssrInterpolate(unref(config).useString("editProfile"))}`);
|
|
} else {
|
|
return [
|
|
createTextVNode(toDisplayString(unref(config).useString("editProfile")), 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(ssrRenderComponent(BasicButton, {
|
|
size: "small",
|
|
block: "",
|
|
class: ["!h-unset !rounded-lg", unref(config).isNightStore ? "border-white text-white bg-black" : "border-black text-black"],
|
|
onClick: ($event) => shareProfile()
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`${ssrInterpolate(unref(config).useString("shareStore"))}`);
|
|
} else {
|
|
return [
|
|
createTextVNode(toDisplayString(unref(config).useString("shareStore")), 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<div class="mt-4 flex -me16px" data-v-99a8b69d>`);
|
|
_push(ssrRenderComponent(Highlights, { "current-user": seller.value }, null, _parent));
|
|
_push(`</div></div><div class="w-full grid grid-cols-3 mt-5 gap-2px" data-v-99a8b69d><!--[-->`);
|
|
ssrRenderList(unref(userPost).posts, (post, i) => {
|
|
_push(`<div class="w-full aspect-square relative" data-v-99a8b69d>`);
|
|
if (post.files?.length) {
|
|
_push(`<!--[-->`);
|
|
if (post.files[0]?.type === "image") {
|
|
_push(`<img${ssrRenderAttrs(_temp0 = mergeProps({
|
|
class: "w-full h-full object-cover",
|
|
alt: unref(reactiveProjectName)
|
|
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(getSupabaseStorageUrl)(post.files[0].url), loading: unref(loadGray), error: unref(loadGray) })))} data-v-99a8b69d>${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}`);
|
|
} else if (post.files[0]?.type === "video") {
|
|
_push(`<div class="relative w-full h-full" data-v-99a8b69d><video${ssrRenderAttr("src", post.files[0]?.url)} class="hidden" data-v-99a8b69d></video><img${ssrRenderAttr("src", videoThumbnails.value[post.files[0]?.url])} class="w-full h-full object-cover" alt="Video Thumbnail" data-v-99a8b69d><div class="absolute inset-0 flex items-center justify-center bg-black bg-opacity-30" data-v-99a8b69d><svg class="w-12 h-12 text-white" fill="currentColor" viewBox="0 0 24 24" data-v-99a8b69d><path d="M8 5v14l11-7z" data-v-99a8b69d></path></svg></div></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<!--]-->`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div>`);
|
|
});
|
|
_push(`<!--]--></div><div style="${ssrRenderStyle(!unref(userPost).loading ? null : { display: "none" })}" class="w-full opacity-0 relative" data-v-99a8b69d> load </div>`);
|
|
if (unref(userPost).loading) {
|
|
_push(ssrRenderComponent(SquarePostSkeleton, null, null, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div></div>`);
|
|
if (selectedStoryId.value) {
|
|
_push(ssrRenderComponent(_sfc_main$3, {
|
|
id: selectedStoryId.value,
|
|
"onUpdate:id": ($event) => selectedStoryId.value = $event,
|
|
specifyId: ""
|
|
}, null, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$2 = _sfc_main$2.setup;
|
|
_sfc_main$2.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/user/userMain/components/Seller.vue");
|
|
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
|
};
|
|
const Seller = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-99a8b69d"]]);
|
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
__name: "index",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(ssrRenderComponent(Seller, _attrs, null, _parent));
|
|
};
|
|
}
|
|
});
|
|
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/base/pages/user/userMain/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/user/index.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main as default };
|
|
//# sourceMappingURL=index-CbUHNoWM.mjs.map
|