Files
tehran_tala/apps/user-app-v2/dist/assets/LoginRegisterView-DruItYRS.js
T
s.esmaeiliandClaude Opus 5.5 1bc3739e78 Merge release/delivery (IAM single sign-on) into the triage work
Brings the four release/delivery commits (IAM SSO for the admin panel,
both apps and the API; IAM env in docker-compose) onto fix/issues-triage.

Conflicts:
- customer-auth.service.ts imports: both kept.
- both apps' api/client.ts: both kept (AccountingBalance/WageQuote, and
  iamAppUrl).
- all build output (admin-panel, user-app, user-app-v2 dist, and the api
  release bundle): rebuilt from the merged source instead of picking a
  side.

Fixed while verifying:
- The IAM change calls iam.browserBootstrapUrl after every login, but
  the identity-service stand-ins in three test files lacked it. 15 tests
  failed on release/delivery itself.
- SMS relay: SMS_RELAY_PLATFORM was read but never sent, so the gateway
  never got `platform` (documented body: phone, host, text, platform).
  relayConfig() now returns it ("default" → null) and the request carries
  it. sms.service.spec now passes.

All 249 API tests pass; the three front-ends type-check and build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 09:03:53 +03:30

2 lines
14 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as E,g as x,Q as N,L as Y,f as v,c as b,w as K,R as ee,b as a,i as L,e as D,F as V,r as te,j as S,C as W,S as se,O as ae,B as H,p as n,z as _,I as C,t as I,m,T as ne,N as A,K as M,s as z,x as oe,U as P,h as le,_ as G,V as q}from"./index-BAr1mMLP.js";import{P as J}from"./PageBar-B1ks8U8i.js";import{a as Q,F,I as B,T as ue}from"./index-BkhudXey.js";import"./FormItemContext-YTkEF048.js";import"./classCallCheck-DDMOgDz1.js";import"./raf-nDFcuFT6.js";const re={class:"otp-single-input"},ie=["type","placeholder","disabled"],ce={key:0},de=["innerHTML"],pe=E({__name:"SingleOtpInput",props:{inputType:{default:"tel"},value:{},separator:{},focus:{type:Boolean},inputClasses:{},shouldAutoFocus:{type:Boolean},isLastChild:{type:Boolean},placeholder:{},disabled:{type:Boolean}},emits:["on-change","on-keydown","on-paste","on-focus","on-blur"],setup(u,{emit:k}){const i=u,g=k,r=x(i.value||""),t=x(null),f=()=>(r.value=r.value.toString(),r.value.length>1&&(r.value=r.value.slice(0,1)),g("on-change",r.value)),p=c=>c>=48&&c<=57||c>=96&&c<=105,o=c=>{i.disabled&&c.preventDefault();const d=c||window.event,e=d.which?d.which:d.keyCode;p(e)||[8,9,13,37,39,46,86].includes(e)?g("on-keydown",c):d.preventDefault()},y=c=>g("on-paste",c),w=()=>(t.value.select(),g("on-focus")),$=()=>g("on-blur");return N(()=>i.value,(c,d)=>{c!==d&&(r.value=c??"")}),N(()=>i.focus,(c,d)=>{d!==c&&t.value&&i.focus&&(t.value.focus(),t.value.select())}),Y(()=>{t.value&&i.focus&&i.shouldAutoFocus&&(t.value.focus(),t.value.select())}),(c,d)=>(v(),b("div",re,[K(a("input",{type:u.inputType,placeholder:u.placeholder,disabled:u.disabled,ref_key:"input",ref:t,min:"0",max:"9",maxlength:"1",pattern:"[0-9]","onUpdate:modelValue":d[0]||(d[0]=e=>r.value=e),class:L(u.inputClasses),onInput:f,onKeydown:o,onPaste:y,onFocus:w,onBlur:$},null,42,ie),[[ee,r.value]]),!u.isLastChild&&u.separator?(v(),b("span",ce,[a("span",{innerHTML:u.separator},null,8,de)])):D("",!0)]))}}),me={class:"flex ltr justify-around w-full"},ve=8,_e=37,fe=39,he=46,ge=E({__name:"OtpInput",props:{defaultFocus:{type:Boolean},numInputs:{default:4},separator:{},inputClasses:{},inputType:{},shouldAutoFocus:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1}},emits:["on-change","on-complete"],setup(u,{emit:k}){const i=u,g=k,r=x(0),t=x([]),f=x([]),p=l=>{i.defaultFocus&&l<i.numInputs&&!t.value[l]?r.value=t.value.length:r.value=l},o=()=>{r.value=-1},y=()=>t.value.join("").length===i.numInputs?g("on-complete",t.value.join("")):"Wait until the user enters the required number of characters",w=l=>{r.value=Math.max(Math.min(i.numInputs-1,l),0)},$=()=>w(r.value+1),c=()=>w(r.value-1),d=l=>{f.value=Object.assign([],t.value),typeof l=="string"&&l===""?t.value.splice(r.value,1):t.value[r.value]=l,f.value.join("")!==t.value.join("")&&(g("on-change",t.value.join("")),y())},e=l=>{var j;l.preventDefault();const R=(((j=l.clipboardData)==null?void 0:j.getData("text/plain"))??"").slice(0,i.numInputs-r.value).split("");if(i.inputType==="number"&&!R.join("").match(/^\d+$/))return"Invalid pasted data";const U=t.value.slice(0,r.value).concat(R);return U.slice(0,i.numInputs).forEach((Z,X)=>{t.value[X]=Z}),w(U.slice(0,i.numInputs).length),y()},h=l=>{d(l),$()},s=l=>{switch(l.keyCode){case ve:l.preventDefault(),d(""),c();break;case he:l.preventDefault(),d("");break;case _e:l.preventDefault(),c();break;case fe:l.preventDefault(),$();break}};return(l,T)=>(v(),b("div",null,[a("div",me,[(v(!0),b(V,null,te(u.numInputs,(R,O)=>(v(),S(pe,{key:O,focus:r.value===O,value:t.value[O],separator:u.separator,"input-type":u.inputType,"input-classes":u.inputClasses,"is-last-child":O===u.numInputs-1,"should-auto-focus":u.shouldAutoFocus,placeholder:u.placeholder,disabled:u.disabled,onOnChange:h,onOnKeydown:s,onOnPaste:e,onOnFocus:U=>p(O),onOnBlur:o},null,8,["focus","value","separator","input-type","input-classes","is-last-child","should-auto-focus","placeholder","disabled","onOnFocus"]))),128))])]))}}),ye=u=>` مقدار ${u} نا معتبر است `,be=u=>({pattern:/^(\+98|0098|98|0)?9\d{9}$/g,message:ye(u)}),ke=u=>({required:!0,message:` لطفا ${u} را وارد کنید `}),xe={class:"auth"},we={class:"auth__intro"},Ie={class:"auth__mark","aria-hidden":"true"},$e={class:"auth__sub"},Oe={class:"auth__card"},Ce={key:0,class:"auth__timer"},Fe={key:1,class:"auth__timer"},Te=["disabled"],Be={class:"auth__switch"},De=E({__name:"LoginView",emits:["register"],setup(u,{emit:k}){const i=k,g=W(),r=se(),t=ae(),f=M({username:void 0}),p=M({step:1,loading:!1,defaultFocus:!1}),o=x(0),y=()=>{o.value>0&&setTimeout(()=>{o.value>0&&(o.value-=1,y())},1e3)},w=async()=>{try{p.loading=!0,await z.requestOtp(String(f.username??"")),p.step=2,o.value=120,y(),await oe(()=>{p.defaultFocus=!0})}catch(h){const s=h instanceof Error&&/\(429\)/.test(h.message)?c(h):null;P.error(s??"خطا در ارسال کد. لطفاً دوباره تلاش کنید.")}finally{p.loading=!1}},$=async h=>{try{p.loading=!0;const s=await z.verifyOtp(String(f.username??""),h),{token:l,customer:T}=s;t.login(l,T.id,T.mobile);try{const O=await z.getExpertIdentity();t.setSalesExpert(O.isSalesExpert)}catch{t.setSalesExpert(!1)}if(s.iamBootstrapUrl){window.location.assign(s.iamBootstrapUrl);return}const R=typeof r.query.redirect=="string"?r.query.redirect:void 0;await g.push(R??{name:"home"}),P.success("با موفقیت وارد شدید")}catch(s){P.error(s instanceof Error&&/\(429\)/.test(s.message)?c(s)??"تعداد تلاش‌ها بیش از حد مجاز است.":"کد وارد شده صحیح نیست")}finally{p.loading=!1}};function c(h){const s=h.message.match(/\{.*\}/);if(!s)return null;try{const l=JSON.parse(s[0]);return typeof l.message=="string"?l.message:null}catch{return null}}const d=h=>h<10?"0"+h:h,e=le(()=>p.step===1?"دریافت رمز عبور":"دریافت مجدد رمز عبور");return(h,s)=>{const l=H("container");return v(),b("div",xe,[n(J,{title:"ورود","back-to":"home"}),n(l,{class:"auth__body"},{default:_(()=>[a("section",we,[a("div",Ie,[n(C,{icon:"vuesax-linear:security-user",size:"28"})]),s[2]||(s[2]=a("h2",{class:"auth__title"},"ورود به منتزر",-1)),a("p",$e,I(p.step===1?"شماره موبایل خود را وارد کنید":"رمز یکبارمصرف را وارد کنید"),1)]),a("section",Oe,[p.step===2?(v(),b(V,{key:0},[n(ge,{class:"auth__otp","input-classes":"otp-input",inputType:"tel","num-inputs":4,"should-auto-focus":!0,defaultFocus:p.defaultFocus,onOnComplete:$},null,8,["defaultFocus"]),o.value>0?(v(),b("p",Ce," امکان دریافت مجدد رمز در "+I(d(o.value))+" ثانیه دیگر ",1)):(v(),b("p",Fe,"برای دریافت رمز عبور مجدد تلاش کنید"))],64)):D("",!0),n(m(Q),{model:f,layout:"vertical",onFinish:w,class:"auth__form"},{default:_(()=>[K(n(m(F),{name:"username",label:"تلفن همراه",rules:[m(ke)("تلفن همراه"),m(be)("تلفن همراه")]},{default:_(()=>[n(m(B),{type:"number",value:f.username,"onUpdate:value":s[0]||(s[0]=T=>f.username=T)},null,8,["value"])]),_:1},8,["rules"]),[[ne,p.step===1]]),a("button",{type:"submit",class:L(["auth__cta",{"is-loading":p.loading}]),disabled:p.loading||o.value>0&&p.step===2},I(e.value),11,Te)]),_:1},8,["model"])]),a("p",Be,[s[3]||(s[3]=A(" اگر ثبت نام نکرده‌اید ",-1)),a("button",{type:"button",onClick:s[1]||(s[1]=T=>i("register",!0))},"ثبت نام کنید")])]),_:1})])}}}),Se=G(De,[["__scopeId","data-v-9dcc7c41"]]),Re={class:"reg"},Ee={class:"reg__doneMark","aria-hidden":"true"},Ae={class:"reg__doneText"},Le={class:"reg__ltr"},Ue={class:"reg__doneActions"},ze={class:"reg__head"},Pe=["aria-valuenow"],Me={class:"reg__stepLabel"},Ve={class:"reg__title"},je={class:"reg__sub"},Ne={key:"s1",class:"reg__fields"},qe={class:"reg__row"},Ke={key:"s2",class:"reg__fields"},We={class:"reg__note"},He={class:"reg__footer"},Ge={class:"reg__footerInner"},Je=["disabled"],Qe={key:0,class:"reg__spinner keep-motion","aria-hidden":"true"},Ze={key:0,class:"reg__switch"},Xe=E({__name:"RegisterView",emits:["register"],setup(u,{emit:k}){const i=k,g=W(),r=x(),t=x(1),f=x(!1),p=x(!1),o=M({fname:void 0,lname:void 0,mobile:void 0,store_name:void 0,phone:void 0,city:void 0,address:void 0}),y=d=>({required:!0,whitespace:!0,message:`لطفاً ${d} را وارد کنید`});function w(d){return(d??"").replace(/[۰-۹]/g,e=>String(e.charCodeAt(0)-1776)).replace(/[٠-٩]/g,e=>String(e.charCodeAt(0)-1632)).replace(/\D/g,"")}function $(){p.value?g.push({name:"home"}):t.value===2?t.value=1:i("register",!1)}async function c(){if(t.value===1){t.value=2,window.scrollTo({top:0,behavior:"smooth"});return}try{f.value=!0,await new Promise(d=>setTimeout(d,600)),p.value=!0,window.scrollTo({top:0})}finally{f.value=!1}}return(d,e)=>{const h=H("container");return v(),b("div",Re,[n(J,{title:"ثبت نام","back-action":$}),n(q,{name:"reg-fade",mode:"out-in"},{default:_(()=>[p.value?(v(),S(h,{key:"done",class:"reg__body reg__done"},{default:_(()=>[a("div",Ee,[e[10]||(e[10]=a("span",{class:"reg__doneRing"},null,-1)),n(C,{icon:"vuesax-linear:tick-circle",size:"40"})]),e[12]||(e[12]=a("h2",{class:"reg__doneTitle"},"درخواست شما ثبت شد",-1)),a("p",Ae,[A(" اطلاعات فروشگاه "+I(o.store_name)+" برای کارشناسان ما ارسال شد. پس از بررسی و تایید، می‌توانید با شماره ",1),a("span",Le,I(o.mobile),1),e[11]||(e[11]=A(" وارد شوید. ",-1))]),a("div",Ue,[a("button",{type:"button",class:"reg__cta",onClick:e[0]||(e[0]=s=>m(g).push({name:"home"}))},"بازگشت به صفحه اصلی"),a("button",{type:"button",class:"reg__ghost",onClick:e[1]||(e[1]=s=>i("register",!1))},"رفتن به صفحه ورود")])]),_:1})):(v(),S(h,{key:"form",class:"reg__body"},{default:_(()=>[a("header",ze,[a("div",{class:"reg__steps",role:"progressbar","aria-valuenow":t.value,"aria-valuemin":"1","aria-valuemax":"2"},[e[13]||(e[13]=a("span",{class:"reg__seg is-on"},null,-1)),a("span",{class:L(["reg__seg",{"is-on":t.value===2}])},null,2)],8,Pe),a("p",Me,"مرحله "+I(t.value===1?"۱":"۲")+" از ۲",1),a("h2",Ve,I(t.value===1?"اطلاعات شما":"اطلاعات فروشگاه"),1),a("p",je,I(t.value===1?"برای ساخت حساب فروشگاه، ابتدا خودتان را معرفی کنید.":"این اطلاعات برای ارسال سفارش و تایید حساب استفاده می‌شود."),1)]),n(m(Q),{ref_key:"formRef",ref:r,model:o,layout:"vertical",class:"reg__form",onFinish:c},{default:_(()=>[n(q,{name:t.value===2?"reg-next":"reg-prev",mode:"out-in"},{default:_(()=>[t.value===1?(v(),b("div",Ne,[a("div",qe,[n(m(F),{name:"fname",label:"نام",rules:[y("نام خود")]},{default:_(()=>[n(m(B),{value:o.fname,"onUpdate:value":e[2]||(e[2]=s=>o.fname=s),placeholder:"مثلاً علی",autocomplete:"given-name",enterkeyhint:"next"},null,8,["value"])]),_:1},8,["rules"]),n(m(F),{name:"lname",label:"نام خانوادگی",rules:[y("نام خانوادگی")]},{default:_(()=>[n(m(B),{value:o.lname,"onUpdate:value":e[3]||(e[3]=s=>o.lname=s),placeholder:"مثلاً محمدی",autocomplete:"family-name",enterkeyhint:"next"},null,8,["value"])]),_:1},8,["rules"])]),n(m(F),{name:"mobile",label:"شماره موبایل",rules:[y("شماره موبایل"),{pattern:/^09\d{9}$/,message:"شماره موبایل باید ۱۱ رقم و با ۰۹ شروع شود"}],extra:"کد ورود به این شماره پیامک می‌شود."},{default:_(()=>[n(m(B),{value:o.mobile,class:"reg__num",type:"tel",inputmode:"numeric",maxlength:11,placeholder:"09123456789",autocomplete:"tel",enterkeyhint:"next","onUpdate:value":e[4]||(e[4]=s=>o.mobile=w(s))},{prefix:_(()=>[n(C,{icon:"vuesax-linear:mobile",size:"18"})]),_:1},8,["value"])]),_:1},8,["rules"])])):(v(),b("div",Ke,[n(m(F),{name:"store_name",label:"نام فروشگاه",rules:[y("نام فروشگاه")]},{default:_(()=>[n(m(B),{value:o.store_name,"onUpdate:value":e[5]||(e[5]=s=>o.store_name=s),placeholder:"مثلاً گالری طلای آفتاب",autocomplete:"organization",enterkeyhint:"next"},{prefix:_(()=>[n(C,{icon:"vuesax-linear:shop",size:"18"})]),_:1},8,["value"])]),_:1},8,["rules"]),n(m(F),{name:"phone",label:"تلفن فروشگاه",rules:[y("تلفن فروشگاه"),{pattern:/^(0\d{10}|\d{8})$/,message:"تلفن را با کد شهر وارد کنید، مثلاً 02112345678"}]},{default:_(()=>[n(m(B),{value:o.phone,class:"reg__num",type:"tel",inputmode:"numeric",maxlength:11,placeholder:"02112345678",autocomplete:"tel-national",enterkeyhint:"next","onUpdate:value":e[6]||(e[6]=s=>o.phone=w(s))},{prefix:_(()=>[n(C,{icon:"vuesax-linear:call",size:"18"})]),_:1},8,["value"])]),_:1},8,["rules"]),n(m(F),{name:"city",label:"شهر",rules:[y("شهر")]},{default:_(()=>[n(m(B),{value:o.city,"onUpdate:value":e[7]||(e[7]=s=>o.city=s),placeholder:"مثلاً تهران",autocomplete:"address-level2",enterkeyhint:"next"},{prefix:_(()=>[n(C,{icon:"vuesax-linear:buildings",size:"18"})]),_:1},8,["value"])]),_:1},8,["rules"]),n(m(F),{name:"address",label:"آدرس پستی",rules:[y("آدرس فروشگاه")]},{default:_(()=>[n(m(ue),{value:o.address,"onUpdate:value":e[8]||(e[8]=s=>o.address=s),rows:3,placeholder:"خیابان، کوچه، پلاک، واحد",autocomplete:"street-address"},null,8,["value"])]),_:1},8,["rules"]),a("div",We,[n(C,{icon:"vuesax-linear:shield-tick",size:"18"}),e[14]||(e[14]=a("span",null,"حساب شما پس از بررسی اطلاعات توسط کارشناسان فعال می‌شود.",-1))])]))]),_:1},8,["name"]),a("footer",He,[a("div",Ge,[a("button",{type:"submit",class:L(["reg__cta",{"is-loading":f.value}]),disabled:f.value},[f.value?(v(),b("span",Qe)):D("",!0),a("span",null,I(t.value===1?"ادامه":f.value?"در حال ثبت…":"ثبت درخواست"),1),t.value===1?(v(),S(C,{key:1,icon:"vuesax-linear:arrow-left",size:"18"})):D("",!0)],10,Je),t.value===1?(v(),b("p",Ze,[e[15]||(e[15]=A(" حساب دارید؟ ",-1)),a("button",{type:"button",onClick:e[9]||(e[9]=s=>i("register",!1))},"وارد شوید")])):D("",!0)])])]),_:1},8,["model"])]),_:1}))]),_:1})])}}}),Ye=G(Xe,[["__scopeId","data-v-84dbe021"]]),lt=E({__name:"LoginRegisterView",setup(u){const k=x(!1),i=g=>k.value=g;return(g,r)=>(v(),b(V,null,[k.value?D("",!0):(v(),S(Se,{key:0,onRegister:i})),k.value?(v(),S(Ye,{key:1,onRegister:i})):D("",!0)],64))}});export{lt as default};