PageSourceSearch

https://app.elxchatbot.ai/assets/index-C8wY3XAH.js

js elxchatbot.ai collected 2026-10-02 06:24:24 UTC 7,611 bytes, 1 lines download raw bytes

1import{M as q,u as te,b as se,O as ae,P as ne,r as s,Q as ie,R as re,U as oe,V as ce,W as le,j as e,X as de,Y as L,Z as ue,G as E,F as P,_ as d,$ as fe,a0 as me,a1 as he,T as v,L as xe,a2 as pe,a3 as V,B as K,a4 as ge,a5 as ye}from"./index-CCrC0TJJ.js";import{C as Se}from"./ChatSessionContainer-D9DQ-Bhn.js";import{B as je}from"./index-Bp--wFXB.js";import{T as Ce}from"./index-s8DTaJ8w.js";import{r as ve,P as Pe,R as we}from"./ResolvePaymentIssueModal-BcVhIsCt.js";import{u as be,l as ke}from"./visa-snpp29fs.js";import{S as _e,a as Ie,s as De,b as Re,c as Ne,d as Be,N as A,e as $,f as Z,g as H,n as W,h as Le}from"./StatOverview-BDjtBUUg.js";import{u as We,G as Oe}from"./Groups-aP7sIVTP.js";import{u as Me}from"./usePermission-Co1KQMC_.js";import"./ChatBox-CuaG80Zx.js";import"./getFileName-BB1Sni6m.js";const Te=({onClose:r})=>{const{chatbotId:a,orgId:o}=q(),g=te(),n=se(),S=ae(),m=ne(),[x,w]=s.useState(""),[j,C]=s.useState(!1),[O,b]=s.useState(!1),[p,k]=s.useState(null),[M,_]=s.useState(!1),[c,u]=s.useState(!1),{data:{data:y}={}}=ie(a),{data:f={},isFetched:I}=re(a),{getSelectedPlan:z,activeCurrency:Q}=be(a),D=f?.success?f?.data?.id:null,T=f?.success?f?.data?.card:null,Y=y?.package_info?.package_id,G=s.useMemo(()=>{const t=y?.package_info;if(!t?.package_id)return null;const i=z(t.package_id);if(i)return i;const l=t.period||"",B=ve(t,Q?.currency_name);return{id:t.package_id,name:t.package_name||"Plan",duration:l.toLowerCase()==="annual"?365:30,currentCurrencyWiseFinalPrice:B.finalPrice,activeCurrency:B.finalCurrency||"USD",subscriptionType:l,dueInPreviousSubscription:0,monthlyFinalPrice
1:l.toLowerCase()==="annual"?B.finalPrice/12:B.finalPrice}},[y?.package_info,z,Q?.currency_name]),R=`/organizations/${o}/chatbots/${a}/complete`,U=s.useRef(!1),h=s.useCallback(()=>{b(!1),C(!1),w(""),k(null),r?.()},[r]),N=s.useCallback(async t=>{if(!t)return n({success:!1,message:"Package information is missing."}),null;try{const i=await S(`subscription/client/payment/create-stripe-payment-intent/${t}/?bot_id=${a}`,"POST",{});if(!i?.success)return n(i),null;const l=i?.data?.clientSecret||"";return l?(w(l),l):(n({success:!1,message:i?.message||"Payment intent was created without a client secret."}),null)}catch(i){return n({success:!1,message:i?.message||"Failed to create payment intent"}),null}},[S,a,n]),X=s.useCallback(async t=>{if(!t){n({success:!1,message:"Unable to continue payment for this plan."}),h();return}if(k(t),!await N(t)){h();return}T?b(!0):C(!0)},[N,T,h,n]);s.useEffect(()=>{U.current||!Y||!I||(U.current=!0,X(Y))},[Y,I,X]);const J=s.useCallback(async()=>{p&&(_(!0),await N(p),_(!1))},[N,p]),F=s.useCallback(async()=>{h(),await m.refetchQueries({queryKey:[oe],exact:!1}),m.invalidateQueries({queryKey:[ce]}),m.invalidateQueries({queryKey:[le]}),g(R)},[h,m,g,R]),ee=s.useCallback(async()=>{if(!x)return n({success:!1,message:"Payment information not available."}),{success:!1};if(!D)return n({success:!1,message:"Default payment method not available."}),{success:!1};try{u(!0);const t=await ke("pk_live_51Q7DoYRoJcs6tsRnZqmxt4iCKCPpADBfcXleLi3nlnmYmsimfBiBDtB2Z6pF4RafsrI9wIYLylEaXBphyB9G4R4n00k5lpK58P");if(!t)return{success:!1,message:"Stripe is not initialized."};const{paymentIntent:i,error:l}=await t.confirmCardPayment(x,{payment_method:D,return_url:`${window.location.origin}${R}`});return l?{success:!1,message:l?.message}:i?.status==="succeeded"?(await F(),{success:!0}):i?.status==="requires_action"?{success:!1,message:"Additional authentication required."}:{success:!1,message:`Payment could not be completed (${i?.status||"unknown status"}).`}}catch(t){return{success:!1,message:t?.message}}finally{u(!1)}},[x,D,R,n,F]);return e.jsxs(e.Fragment,{children:[j&&x&&e.jsx(de,{open:j,onClose:h,title:"Please enter your card details",maxWidth:560,minWidth:560,contentSx:{pt:0},children:e.jsx(Pe,{clientSecret:x,onClose:h,selectedPlan:G,onClientSecretExpired:J,isRefreshingClientSecret:M,onSuccess:F,showTitle:!1})}),e.jsx(we,{open:O,onClose:h,defaultCardDetails:T,defaultCardId:D,selectedPlan:G,onPayNow:ee,isProcessingPayment:c})]})},Ye=()=>e.jsx(Ie,{container:!0,spacing:2.5,mt:4,children:De.map(({bg:r},a)=>e.jsx(E,{item:!0,size:{xs:12,sm:6,lg:3},sx:{minWidth:0},children:e.jsx(Re,{bg:r,children:e.jsxs(P,{gap:2,children:[e.jsx(Ne,{children:e.jsx(d,{variant:"rounded",width:32,height:32})}),e.jsxs(Be,{children:[e.jsx(d,{variant:"text",width:"70%",height:24}),e.jsx(d,{variant:"text",width:"45%",height:40})]})]})})},a))}),Fe=({...r})=>{const{chatbotId:a}=q(),o=L().subtract(1,"year"),g=L(),{data:{data:{analytics:n,statistics:S}={}}={},isLoading:m}=ue(a,{start_date:L(o).format("DD-MM-YYYY"),end_date:L(g).format("DD-MM-YYYY"),statistics:!1,analytics:!0});return m?e.jsx(Ye,{}):e.jsx(_e,{analytics:n,...r})},Ee=()=>{const{orgId:r,chatbotId:a}=q(),o=Me("view_session"),{useSocketState:g,actions:{setInitialNotifications:n,clearMessages:S,setOpenChatSession:m,socketInitializeHandler:x,socketCloseHandler:w}}=fe(),{initialNotificationList:j=[],openedChatSession:C,initialChatSessionList:O=[],socketSessionList:b=[]}=g(),{data:p,isLoading:k}=We(a);s.useEffect(()=>{p?.pages&&n(p.pages.flatMap(c=>c.data))},[p]);const M=me(b,O),_=c=>{const u=c?.content_object?.session_id;if(u!==C?.session_id){w(),S();const f=M.find(I=>I?.session_id===u)||c?.content_object;m(f),f?.session_has_ended||x(u)}};return k?e.jsx(Ae,{}):o?e.jsxs(A,{children:[e.jsxs(P,{justifyContent:"space-between",mb:2,sx:{gap:1,minWidth:0,flexWrap:"wrap",flexShrink:0},children:[e.jsx(v,{variant:"h5-semibold",children:"Notification"}),j?.length>0&&e.jsx(xe,{to:{pathname:`/organizations/${r}/chatbots/${a}/notifications`},children:e.jsx(v,{variant:"link",color:pe.primary.main,children:"View all"})})]}),e.jsx(V,{sx:{flexShrink:0}}),e.jsx($,{children:j?.map((c,u)=>{const y=c?.notification_text,f=c?.created_at;return e.jsx(Z,{onClick:()=>_(c),selected:c?.content_object?.session_id===C?.session_id,children:e.jsxs(P,{alignItems:"start",sx:{minWidth:0},children:[e.jsx(H,{bg:W[u%W.length],children:e.jsx(Oe,{sx:{color:"white"}})}),e.jsxs(K,{sx:{flex:1,minWidth:0},children:[e.jsx(v,{variant:"body-semibold",mb:1,sx:{overflowWrap:"anywhere"},children:y}),e.jsx(v,{children:ge(f)})]})]})},u)})})]}
1):e.jsx(A,{children:e.jsx($,{children:e.jsx(he,{content:"Access Denied"})})})},Ae=({items:r=5})=>e.jsxs(A,{children:[e.jsxs(P,{justifyContent:"space-between",mb:2,children:[e.jsx(d,{variant:"text",width:120,height:32}),e.jsx(d,{variant:"text",width:64,height:28})]}),e.jsx(V,{sx:{flexShrink:0}}),e.jsx($,{children:Array.from({length:r}).map((a,o)=>e.jsx(Z,{children:e.jsxs(P,{alignItems:"start",children:[e.jsx(H,{bg:W[o%W.length],opacity:.1,children:e.jsx(d,{variant:"circular",width:20,height:20})}),e.jsxs(K,{sx:{flex:1},children:[e.jsx(d,{variant:"text",width:"88%",height:24}),e.jsx(d,{variant:"text",width:"46%",height:24}),e.jsx(d,{variant:"text",width:"0",height:8}),e.jsx(d,{variant:"text",width:"24%",height:20})]})]})},`notification-skeleton-${o}`))})]}),Je=()=>{const r=ye("(max-width:1200px)"),[a,o]=s.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(K,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:1.5},children:[e.jsx(v,{variant:r?"body-semibold":"h4-semibold",children:"Overview"}),e.jsx(je,{})]}),e.jsx(Ce,{sx:{mt:3},onResolvePayment:()=>o(!0)}),e.jsx(Fe,{mt:4}),e.jsxs(Le,{container:!0,children:[e.jsx(E,{item:!0,size:{xs:12,lg:8},sx:{minWidth:0},children:e.jsx(Se,{isOverview:!0,isFilterOptionSattled:!0})}),e.jsx(E,{item:!0,size:{xs:12,lg:4},sx:{minWidth:0},children:e.jsx(Ee,{})})]}),a&&e.jsx(Te,{onClose:()=>o(!1)})]})};export{Je as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.