D20: OTP_MASTER_CODE login bypass read only from the environment, disabled when unset, audited on every use, with a boot banner while armed. SMS no longer aborts the boot in production — it warns and declines silently, so no message can stop an operation. D19: port Utility::faTOen onto admin-entered mobiles (before the uniqueness lookup, which could previously be bypassed with Persian digits), and the create-only welcome SMS, byte-identical to the reference and fire-and-forget. user-app-v2 was missing the cart stock ceiling entirely: capQty/maxQty, the un-orderable guard and the qty clamp are ported, leaving v2's own design intact. The two cart stores are now byte-identical. isVariantOrderable and the orderable-first default selection ported too. jest 45/45; typecheck clean on api, admin-panel, user-app, user-app-v2. [ref: henza_server/app/Http/Controllers/Adm/AdminController.php:333,348,364,378-387] [ref: henza_server/app/Models/Utility.php:26] Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
import{d as me,ae as Re,a as be,f as l,c as n,b as t,n as qe,F as G,r as H,t as i,e as c,A as De,i as z,af as _e,g as m,h as o,_ as he,p as Oe,m as ke,G as Fe,C as Me,u as w,j as L,s as $,l as d,I as _,D as R,ag as Ve,Y as pe,T as Be,x as Ae,v as Le}from"./index-B3AQ-Dpo.js";import{a as Ue}from"./Spinner.vue_vue_type_style_index_0_lang-DKSb2qK3.js";import{_ as Xe}from"./NotifyVant.vue_vue_type_script_setup_true_lang-BrkU_j90.js";import{_ as Ee}from"./DialogVant.vue_vue_type_style_index_0_lang-CIIQfCa1.js";import{a as Ne,u as je}from"./cartStore-JeDfPEiX.js";import{l as Ge}from"./dialogEmpty1-Caw7F5KL.js";const He=["src","alt"],Qe={key:0,class:"gs__counter"},fe=.18,We=6,Ye=me({__name:"GallerySlider",props:_e({slides:{},alt:{},fit:{default:"cover"},showCounter:{type:Boolean,default:!1}},{index:{default:0},indexModifiers:{}}),emits:_e(["tap"],["update:index"]),setup(v,{emit:x}){const h=v,f=Re(v,"index"),P=x,D=o(()=>h.fit==="contain"?"gs__img--contain":"gs__img--cover"),S=m(null),r=m(!1),C=m(0);let b=null,q=0,g=0;function O(a){var k;if(h.slides.length<2||b!==null)return;const y=S.value;y&&(b=a.pointerId,q=a.clientX,g=y.getBoundingClientRect().width||1,C.value=0,r.value=!0,(k=y.setPointerCapture)==null||k.call(y,a.pointerId))}function U(a){!r.value||a.pointerId!==b||(C.value=a.clientX-q)}function X(){if(!r.value)return;const a=C.value,y=a/g;r.value=!1,b=null,C.value=0,y<=-fe&&f.value<h.slides.length-1?f.value++:y>=fe&&f.value>0&&f.value--,Math.abs(a)<=We&&P("tap")}function Q(a){a.pointerId===b&&X()}function p(a){a.pointerId===b&&(r.value=!1,b=null,C.value=0)}function W(){}function Y(a){f.value=a}const E=o(()=>{const a=-f.value*100,y=g?C.value/g*100:0;return{transform:`translate3d(${a+y}%, 0, 0)`,transition:r.value?"none":void 0}});return be(()=>{if(b!==null&&S.value)try{S.value.releasePointerCapture(b)}catch{}}),(a,y)=>(l(),n("div",{ref_key:"root",ref:S,class:z(["gs",{"is-dragging":r.value}]),onPointerdown:O,onPointermove:U,onPointerup:Q,onPointercancel:p,onClick:W},[t("div",{class:"gs__track",style:qe(E.value)},[(l(!0),n(G,null,H(v.slides,k=>(l(),n("div",{key:k,class:"gs__cell"},[t("img",{src:k,alt:v.alt,class:z(["gs__img",D.value]),draggable:"false"},null,10,He)]))),128))],4),v.showCounter&&v.slides.length>1?(l(),n("div",Qe,i(f.value+1)+"/"+i(v.slides.length),1)):c("",!0),De(a.$slots,"dots",{index:f.value,go:Y},void 0,!0)],34))}}),ge=he(Ye,[["__scopeId","data-v-c30d71a6"]]);function Je(v){const x=m(!1),h=m(!1),f=m(!1),P=m(null);return{loading:x,flag:h,notFound:f,productRef:P,load:async()=>{x.value=!0;try{const r=(await Oe.listProducts()).find(C=>C.id===v)??null;P.value=r,f.value=!r,h.value=!0}catch(S){console.log(S)}finally{x.value=!1}}}}const Ke=ke("favorites",{state:()=>({ids:[]}),actions:{toggle(v){const x=this.ids.indexOf(v);x===-1?this.ids.push(v):this.ids.splice(x,1)},isFavorite(v){return this.ids.includes(v)}}}),ye={colors:[],brands:[],ciny_id:[],limit_percent:[],limit_gram:[],has_discount:!1,text:void 0,cats:void 0,page:0},Ze=ke("filters",{state:()=>({query:{...ye}}),actions:{reset(){this.query={...ye}}}});function et(){return localStorage.getItem("appToken")}const tt={class:"pd__controls"},st={class:"pd__headerTitle"},lt={class:"pd__controlsEnd"},at={key:0,class:"pd__roundBadge"},nt={class:"pd__gallery"},ot={key:0,class:"pd__rail"},it=["aria-label","onClick"],ut={key:1,class:"pd__stage pd__stage--empty"},rt={key:2,class:"pd__expand","aria-hidden":"true"},dt={class:"pd__scroll"},ct={class:"pd__sheet"},vt={class:"pd__eyebrow"},_t={class:"pd__eyebrowText"},pt={class:"pd__head"},ft={class:"pd__headMain"},gt={class:"pd__title"},yt={key:0,class:"pd__code"},mt={class:"pd__figures"},bt={class:"pd__figure"},ht={class:"pd__figureValue"},kt={key:0,class:"pd__figure pd__figure--accent"},xt={class:"pd__figureValue"},Ct={key:0,class:"pd__chips no-scrollbar"},wt=["onClick"],Pt={key:1,class:"pd__block"},St={class:"pd__block"},Tt={class:"pd__specs"},It={class:"pd__spec"},$t={key:0,class:"pd__spec"},zt={key:1,class:"pd__spec"},Rt={key:2,class:"pd__spec"},qt={key:3,class:"pd__spec"},Dt={class:"pd__bar"},Ot={key:0,class:"pd__qty"},Ft={class:"pd__qtyValue"},Mt=["aria-label"],Vt={class:"pd__pillText"},Bt=["disabled"],At={key:0,class:"pd__previewCounter"},Lt={key:1,class:"pd__previewThumbs no-scrollbar"},Ut=["aria-label","onClick"],Xt=["src","alt"],Et=["src"],Nt=56,jt=me({__name:"SingleProduct",props:{id:{}},emits:["closeDrawer"],setup(v,{emit:x}){const h=v,f=x,P=Ae(),D=Ke(),S=Ze(),r=Ne(),C=()=>{f("closeDrawer"),P.currentRoute.value.name==="singleProduct"&&P.back()},b=m(!1),q=m(!1),g=m(0),O=m(!1),U=m(null),X=m(!1);function Q(){var A;const s=U.value;if(!s)return;const e=((A=s.querySelector(".pd__gallery"))==null?void 0:A.clientHeight)??0;X.value=s.scrollTop>Math.max(e-Nt,0)}const p=Je(h.id),W=p.loading,Y=p.flag,E={id:h.id,title:"",description:null,variants:[],images:[],category:null,brand:null,collections:[]},a=o(()=>je(p.productRef.value??E)),y=o(()=>a.value.id.value),k=o(()=>a.value.title.value),ne=o(()=>a.value.productCode.value),J=o(()=>a.value.variants.value),V=o({get:()=>a.value.selectedVariant.value,set:s=>a.value.selectedVariant.value=s}),oe=o(()=>a.value.min_gram.value),K=o(()=>a.value.wage.value),Z=o(()=>a.value.qty.value),ie=o(()=>a.value.isPreOrder.value),ee=o(()=>a.value.is_exist.value),te=o(()=>{var s;return((s=p.productRef.value)==null?void 0:s.description)??""}),xe=o(()=>te.value.length>120),ue=o(()=>{var s,e;return((e=(s=p.productRef.value)==null?void 0:s.category)==null?void 0:e.id)??""}),B=o(()=>{var s,e;return((e=(s=p.productRef.value)==null?void 0:s.category)==null?void 0:e.title)??""}),re=o(()=>{var s,e;return((e=(s=p.productRef.value)==null?void 0:s.brand)==null?void 0:e.title)??""}),se=o(()=>{var s;return(((s=p.productRef.value)==null?void 0:s.images.length)??0)>0}),T=o(()=>{var s;return((s=p.productRef.value)==null?void 0:s.images.map(e=>e.url))??[]});Fe(T,s=>{g.value>s.length-1&&(g.value=0)});const N=m(!1);function Ce(){se.value&&(N.value=!0,document.body.style.overflow="hidden")}function de(){N.value=!1,document.body.style.overflow=""}const ce=o(()=>{const s=K.value;return s==null?"":s%1===0?String(s):s.toFixed(2)}),we=o(()=>Z.value>0?`${Z.value} عدد موجود`:ie.value?"پیشسفارش":"ناموجود"),Pe=o(()=>Z.value>0?"is-in":ie.value?"is-pre":"is-out"),F=o(()=>{var s,e;return{vid:((s=V.value)==null?void 0:s.id)??"",note:null,pid:((e=p.productRef.value)==null?void 0:e.id)??h.id,product:p.productRef.value??E,qty:1}}),ve=o(()=>r.isInCart(F.value)),j=o(()=>r.find_index(F.value)),M=o(()=>j.value>-1?r.items[j.value].qty:0),Se=()=>r.updateFeild(M.value+1,j.value,F.value,"qty"),Te=()=>{if(M.value<=1){r.remove(F.value);return}r.updateFeild(M.value-1,j.value,F.value,"qty")},Ie=()=>{r.addToCart(F.value),b.value=!0},$e=s=>{s.stopPropagation(),D.toggle(h.id)},ze=()=>{ue.value&&(S.query.cats=[ue.value],f("closeDrawer"),P.push({name:"search"}))};return Me(async()=>{await p.load()}),be(()=>{N.value&&(document.body.style.overflow="")}),(s,e)=>{const A=Le("router-link");return w(Y)&&w(p).productRef.value?(l(),L(Ue,{key:0,spinning:w(W),tip:"درحال دریافت اطلاعات"},{default:$(()=>[t("article",{class:"pd",ref_key:"scroller",ref:U,onScrollPassive:Q},[t("header",{class:z(["pd__header",{"is-solid":X.value}])},[t("div",tt,[t("button",{type:"button",class:"pd__round","aria-label":"بازگشت",onClick:C},[d(_,{icon:"vuesax-linear:arrow-right-1",size:"18"})]),t("h2",st,i(k.value),1),t("div",lt,[t("button",{type:"button",class:z(["pd__round",{"is-on":w(D).isFavorite(y.value)}]),"aria-label":"علاقهمندی",onClick:$e},[d(_,{icon:w(D).isFavorite(y.value)?"vuesax-linear:heart-fill":"vuesax-linear:heart",size:"18"},null,8,["icon"])],2),d(A,{class:"pd__round",to:{name:"cart"},"aria-label":"سبد خرید"},{default:$(()=>[d(_,{icon:"vuesax-linear:bag-2",size:"18"}),w(r).items.length?(l(),n("span",at,i(w(r).items.length),1)):c("",!0)]),_:1})])])],2),t("div",nt,[se.value?(l(),L(ge,{key:0,index:g.value,"onUpdate:index":e[0]||(e[0]=u=>g.value=u),slides:T.value,alt:k.value,class:"pd__stage",onTap:Ce},{dots:$(({index:u,go:I})=>[T.value.length>1?(l(),n("div",ot,[(l(!0),n(G,null,H(T.value,(le,ae)=>(l(),n("button",{key:le,type:"button",class:z(["pd__railDot",{"is-on":ae===u}]),"aria-label":`تصویر ${ae+1}`,onClick:pe(Ht=>I(ae),["stop"])},null,10,it))),128))])):c("",!0)]),_:1},8,["index","slides","alt"])):(l(),n("div",ut,[d(_,{icon:"vuesax-linear:diamonds",size:"27"})])),se.value?(l(),n("span",rt,[d(_,{icon:"vuesax-linear:maximize-4",size:"15"})])):c("",!0)]),t("div",dt,[t("div",ct,[e[18]||(e[18]=t("div",{class:"pd__grip","aria-hidden":"true"},null,-1)),t("div",vt,[t("span",_t,i(B.value||"محصول"),1),t("span",{class:z(["pd__stock",Pe.value])},[e[8]||(e[8]=t("span",{class:"pd__stockDot","aria-hidden":"true"},null,-1)),R(" "+i(we.value),1)],2)]),t("header",pt,[t("div",ft,[t("h1",gt,i(k.value),1),ne.value?(l(),n("p",yt,i(ne.value),1)):c("",!0)]),t("div",mt,[t("div",bt,[t("span",ht,i(oe.value),1),e[9]||(e[9]=t("span",{class:"pd__figureLabel"},"گرم",-1))]),K.value!=null?(l(),n("div",kt,[t("span",xt,i(ce.value)+"٪",1),e[10]||(e[10]=t("span",{class:"pd__figureLabel"},"اجرت",-1))])):c("",!0)])]),J.value&&J.value.length>1?(l(),n("section",Ct,[(l(!0),n(G,null,H(J.value,u=>{var I;return l(),n("button",{key:u.id,type:"button",class:z(["pd__chip",{"is-on":((I=V.value)==null?void 0:I.id)===u.id}]),onClick:le=>V.value=u},i(u.title),11,wt)}),128))])):c("",!0),te.value?(l(),n("section",Pt,[e[11]||(e[11]=t("h2",{class:"pd__blockTitle"},"توضیحات",-1)),t("p",{class:z(["pd__body",{"is-clamped":!O.value}])},i(te.value),3),xe.value?(l(),n("button",{key:0,type:"button",class:"pd__more",onClick:e[1]||(e[1]=u=>O.value=!O.value)},i(O.value?"بستن":"ادامه مطلب"),1)):c("",!0)])):c("",!0),t("section",St,[e[17]||(e[17]=t("h2",{class:"pd__blockTitle"},"مشخصات",-1)),t("dl",Tt,[t("div",It,[t("dt",null,[d(_,{icon:"vuesax-linear:weight",size:"15"}),e[12]||(e[12]=R(" وزن",-1))]),t("dd",null,i(oe.value)+" گرم",1)]),K.value!=null?(l(),n("div",$t,[t("dt",null,[d(_,{icon:"vuesax-linear:percentage-square",size:"15"}),e[13]||(e[13]=R(" اجرت",-1))]),t("dd",null,i(ce.value)+"٪",1)])):c("",!0),V.value?(l(),n("div",zt,[t("dt",null,[d(_,{icon:"vuesax-linear:diamonds",size:"15"}),e[14]||(e[14]=R(" تنوع",-1))]),t("dd",null,i(V.value.title),1)])):c("",!0),B.value?(l(),n("div",Rt,[t("dt",null,[d(_,{icon:"vuesax-linear:category",size:"15"}),e[15]||(e[15]=R(" دستهبندی",-1))]),t("dd",null,i(B.value),1)])):c("",!0),re.value?(l(),n("div",qt,[t("dt",null,[d(_,{icon:"vuesax-linear:shop",size:"15"}),e[16]||(e[16]=R(" برند",-1))]),t("dd",null,i(re.value),1)])):c("",!0)])])])]),t("div",Dt,[ve.value?(l(),n("div",Ot,[t("button",{type:"button",class:"pd__qtyBtn","aria-label":"افزایش",onClick:Se},[d(_,{icon:"vuesax-linear:add",size:"15"})]),t("span",Ft,i(M.value),1),t("button",{type:"button",class:"pd__qtyBtn","aria-label":M.value===1?"حذف":"کاهش",onClick:Te},[d(_,{icon:M.value===1?"vuesax-linear:trash":"vuesax-linear:minus",size:"15"},null,8,["icon"])],8,Mt)])):B.value?(l(),n("button",{key:1,type:"button",class:"pd__pill",onClick:ze},[d(_,{icon:"vuesax-linear:category",size:"17"}),t("span",Vt,i(B.value),1)])):c("",!0),ve.value?(l(),L(A,{key:3,class:"pd__cta",to:{name:"cart"}},{default:$(()=>[d(_,{icon:"vuesax-linear:bag-2",size:"17"}),e[19]||(e[19]=R(" مشاهده سبد خرید ",-1))]),_:1})):(l(),n("button",{key:2,type:"button",class:"pd__cta",disabled:!ee.value,onClick:e[2]||(e[2]=u=>w(et)()?Ie():q.value=!0)},[ee.value?(l(),L(_,{key:0,icon:"vuesax-linear:bag-2",size:"17"})):c("",!0),R(" "+i(ee.value?"افزودن به سفارش":"ناموجود"),1)],8,Bt))])],544),(l(),L(Ve,{to:"body"},[d(Be,{name:"pd-preview"},{default:$(()=>[N.value?(l(),n("div",{key:0,class:"pd__preview",onClick:pe(de,["self"])},[t("button",{type:"button",class:"pd__previewClose","aria-label":"بستن",onClick:de},[d(_,{icon:"vuesax-linear:add",size:"20"})]),T.value.length>1?(l(),n("div",At,i(g.value+1)+" / "+i(T.value.length),1)):c("",!0),d(ge,{index:g.value,"onUpdate:index":e[3]||(e[3]=u=>g.value=u),slides:T.value,alt:k.value,class:"pd__previewStage",fit:"contain"},null,8,["index","slides","alt"]),T.value.length>1?(l(),n("div",Lt,[(l(!0),n(G,null,H(T.value,(u,I)=>(l(),n("button",{key:u,type:"button",class:z(["pd__previewThumb",{"is-on":I===g.value}]),"aria-label":`تصویر ${I+1}`,onClick:le=>g.value=I},[t("img",{src:u,alt:`${k.value} ${I+1}`,draggable:"false"},null,8,Xt)],10,Ut))),128))])):c("",!0)])):c("",!0)]),_:1})])),d(Xe,{timeOut:3e3,modelValue:b.value,"onUpdate:modelValue":e[4]||(e[4]=u=>b.value=u),color:"background-color: #14161A"},{default:$(()=>[...e[20]||(e[20]=[t("div",{class:"font-bold text-right mb-2"},"ثبت سفارش",-1),t("div",null,"محصول با موفقیت به سبد خرید افزوده شد",-1)])]),_:1},8,["modelValue"]),d(Ee,{timeOut:-1,show:q.value,"onUpdate:show":e[7]||(e[7]=u=>q.value=u),closeOnClickOverlay:!0},{img:$(()=>[t("img",{src:w(Ge),alt:"",class:"opacity-80"},null,8,Et)]),title:$(()=>[...e[21]||(e[21]=[t("div",{class:"p-8 text-justify"}," برای دسترسی به تمامی امکانات نرم افزار منتزر، ابتدا گزینه ورود/ثبت نام را لمس کنید و در صورت نداشتن حساب کاربری، ثبت نام نمایید. ",-1)])]),button:$(()=>[t("div",{class:"text-center font-bold",onClick:e[5]||(e[5]=u=>w(P).push({name:"login"}))},"ورود/ثبت نام"),t("div",{class:"text-center",onClick:e[6]||(e[6]=u=>q.value=!1)},"بیخیال")]),_:1},8,["show"])]),_:1},8,["spinning"])):c("",!0)}}}),Gt=he(jt,[["__scopeId","data-v-cb79448a"]]),es=Object.freeze(Object.defineProperty({__proto__:null,default:Gt},Symbol.toStringTag,{value:"Module"}));export{Gt as S,Ke as a,es as b,Ze as u};
|