Files
tehran_taj/apps/user-app-v2/dist/assets/DashboardView-D-g2Xx7S.js
T

2 lines
11 KiB
JavaScript
Raw Normal View History

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