2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
import{d as K,S as Y,y as j,h as f,K as $,A as J,o as Q,z as W,c as u,p as t,C,m as i,s as D,T as F,D as X,O as Z,v as L,b as _,I as n,f as O,n as y,e as s,t as c,R as ss,g as T,B as es,F as as,i as I,E as ts,_ as os}from"./index-6E0fX61D.js";import{A as ns}from"./AppPullRefresh-B0f-tYJA.js";import{P as is}from"./PageBar-HEcoSwjE.js";import{R as rs}from"./RateStrip-BM0cz1ET.js";import{p as ls}from"./filters-CmtC5ctw.js";import{D as ds}from"./index-BRKIhLwl.js";import"./KeyCode-CJkaCAgc.js";import"./classCallCheck-BINKwNli.js";import"./raf-nDFcuFT6.js";const us={class:"dash"},_s={key:1,class:"dash__exitSpacer","aria-hidden":"true"},hs={class:"dash__heroHead"},cs={class:"dash__heroIdentity"},ps={class:"dash__heroName"},vs={class:"dash__heroMobile"},fs={class:"dash__heroBalance"},ms={class:"dash__heroFigure"},bs={class:"dash__heroNum"},ws={class:"dash__heroDebt"},ys={class:"dash__heroHead"},gs={class:"dash__heroIdentity"},xs={class:"dash__heroMobile"},ks={class:"dash__heroPending"},Cs=["alt"],Is={class:"dash__rowIcon","aria-hidden":"true"},zs={class:"dash__rowChevron","aria-hidden":"true"},Ss={class:"dash__rowIcon","aria-hidden":"true"},$s={class:"dash__rowChevron","aria-hidden":"true"},Ds={class:"dash__rowIcon","aria-hidden":"true"},Ls={class:"dash__rowText"},Ts={class:"dash__rowChevron","aria-hidden":"true"},Bs={class:"dash__rowIcon","aria-hidden":"true"},Es={class:"dash__rowChevron","aria-hidden":"true"},Ns={class:"dash__rowIcon","aria-hidden":"true"},Rs={class:"dash__rowChevron","aria-hidden":"true"},Ps={class:"dash__rowIcon","aria-hidden":"true"},Vs={class:"dash__rowChevron","aria-hidden":"true"},Fs={class:"dash__rowIcon","aria-hidden":"true"},Os={class:"dash__rowChevron","aria-hidden":"true"},As={class:"dash__rowIcon","aria-hidden":"true"},Ms={class:"dash__rowChevron","aria-hidden":"true"},Us={class:"dash__rowIcon","aria-hidden":"true"},qs={class:"dash__rowChevron","aria-hidden":"true"},Gs={class:"dash__rowIcon","aria-hidden":"true"},Hs={class:"dash__rowChevron","aria-hidden":"true"},Ks={class:"dash__choice"},Ys=70,js=K({__name:"DashboardView",setup(Js){const r=X(),l=Y(),m=j(),d=f(m.peek($.profile)??null),B=f(m.peek($.goldPrice)??null),g=f(m.peek($.customButton)??null),z=f(!1),b=f(!1),A=I(()=>{const a=g.value;return!!(a!=null&&a.enabled&&a.title.trim()&&a.link.trim())});function M(){var e,v;const a=(v=(e=g.value)==null?void 0:e.link)==null?void 0:v.trim();a&&window.open(a,"_blank","noopener,noreferrer")}const E=I(()=>d.value?parseFloat(d.value.goldDebtGrams)>0:!1),U=I(()=>d.value?Math.abs(parseFloat(d.value.goldDebtGrams)):0),q=I(()=>{const a=U.value;return Number.isFinite(a)?a.toLocaleString("fa-IR",{maximumFractionDigits:3}):"۰"}),p=Z({notify:!1,loginNotify:!1});function h(a){if(!l.isLoggedIn){p.loginNotify=!0;return}a===0&&r.push({name:"ordersList"}),a===1&&r.push({name:"transactionsList"}),a===2&&r.push({name:"profileData"}),a===3&&r.push({name:"favoritesList"}),a===4&&r.push({name:"ChildOrder"}),a===5&&r.push({name:"customerChoice"}),a===6&&r.push({name:"report"}),a===7&&(x.value=!0)}const x=f(!1);function N(a){x.value=!1,r.push({name:a})}async function G(){p.notify=!1;try{await L.endSharedSession()}catch{}let a=null;try{a=(await L.ssoLogoutUrl()).logout_url}catch{a=null}if(l.logout(),sessionStorage.removeItem("gb_iam_sso_checked"),a){window.location.assign(a);return}r.push({name:"home"})}async function k(){b.value=!1;const[a,e,v]=await Promise.allSettled([l.isLoggedIn?m.me({force:!0}):Promise.resolve(null),m.goldPrice({force:!0}),m.customButton({force:!0})]);a.status==="fulfilled"?(d.value=a.value,b.value=!1):(b.value=l.isLoggedIn&&!d.value,console.log(a.reason)),B.value=e.status==="fulfilled"?e.value:null,v.status==="fulfilled"&&(g.value=v.value)}async function H(){try{await k()}finally{z.value=!1}}async function R(){if(l.isLoggedIn)try{const a=await L.getExpertIdentity();l.setSalesExpert(a.isSalesExpert)}catch{}}let P=!1;J(()=>{P&&(k(),R()),P=!0});let V=!1;const S=f(V);function w(a){return{"--reveal-delay":`${a*Ys}ms`}}return Q(async()=>{R(),await k(),!S.value&&(await W(),requestAnimationFrame(()=>{S.value=!
|